日期:2014-05-17 浏览次数:20725 次
CREATE PROCEDURE spCustomerList @sqlWhere varchar(300) AS Declare @sql varchar(500) set @sql = 'SELECT * FROM [Customer] ' if (@sqlWhere!='') declare @TempID int begin select @TempID=count(1) from [Customer] where@Sqlwhere if @TempID=0 return 0 else return 1 end GO
CREATE PROCEDURE spCustomerList @sqlWhere varchar(300) , @rtn int OUTPUT AS begin Declare @sql varchar(500) if (@sqlWhere is not null and len(@sqlWhere) > 0) begin declare @TempID int set @sql = 'select @a = count(1) from [Customer] where ' + @Sqlwhere exec sp_executesql @sql , N'@a int output' , @TempID output if @TempID = 0 return 0 else return 1 end end GO