Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.
ALTER proc spPrincipalTest ( @uid varchar(30) ) as DECLARE @ufilter nvarchar(200) DECLARE @uexpdate datetime DECLARE @CMD nvarchar(200) select @ufilter=ufilter, @uexpdate=uexpdate from UFILTERS where uid=@uid Print @ufilter IF ISNULL(@ufilter, 'ZZTOP') = 'ZZTOP' BEGIN select * from dvASTUCurrentShort where 1 = 2 END IF @ufilter = 'NONE' BEGIN select * from dvASTUCurrentShort order by Lastname, Firstname END ELSE BEGIN set @cmd = 'select * from dvASTUCurrentShort where ' + @ufilter print @cmd exec sp_executesql @cmd, @ufilter END Output: schoolnum='032' select * from dvASTUCurrentShort where schoolnum='032' Incorrect syntax near 'schoolnum'. No rows affected. (0 row(s) returned) @RETURN_VALUE = 0 Finished running [dbo].[spPrincipalTest].
Join the community of 500,000 technology professionals and ask your questions.