create procedure dbo.GetData<br> @Name varchar(8),<br> @Age int<br>AS<br>if( Len(@Name)=0 )<br>begin<br> if( @Age=0 )<br> begin<br> Select * From Tb1<br> end<br> else<br> begin<br> Select * From Tb1 Where Age=@Age<br> end<br>end<br>else<br>begin<br> if( @Age=0 )<br> begin<br> Select * From Tb1 Where Name=@Name<br> end<br> else<br> begin<br> Select * From Tb1 Where Age=@Age And Name=@Name<br> end<br>end<br><br>GO<br><br>——SQL Server上差不多应该是这样