大家看看我这这储存过程是怎么回事
ALTER PROC [dbo].[Getlist]@RecNum varchar(10)='',@UserName varchar(10)='',@StartNum varchar(10)='',@endNum varchar(10)='',@Order varchar(10)='',@return varchar(255)='' outputASdeclare @endSqlStr varchar(255)declare @SQL varchar(255)declare @selectForm varchar(255)declare @W_YiQi varchar(255)declare @orderby varchar(6)set @selectForm=N'select * from RegInfo'if(@Order='')begin set @orderby=N' id 'endelsebegin set @orderby= N' RegTime 'endif (@RecNum!='')begin set @W_YiQi=' AND recNum in ( '+@RecNum+' ) 'end elsebeginset @W_YiQi=''endif (@StartNum!='' and @endNum!='')begin set @W_YiQi=' AND recNum >='+@StartNum+' AND recNum<= '+@endNumend if (@UserName='')begin set @endSqlStr=@selectForm+ ' WHERE id>0 '+@W_YiQi +' order by '+@orderbyENDELSEBEGIN set @endSqlStr=@selectForm+ ' WHERE UserName='''+@UserName+''' '+@W_YiQi +' order by '+@orderbyENDset @return =@endSqlStr
USE [regInfoData]GODECLARE @return_value int, @return varchar(255)EXEC @return_value = [dbo].[Getlist] @RecNum = N'65535',@Order= N'1', @return = @return OUTPUTSELECT @return as N'@return'SELECT 'Return Value' = @return_valueGO