CREATE proc uspcachehitchk as begin DECLARE @sal bigint; DECLARE @SQLString nvarchar(500); DECLARE @ParmDefinition nvarchar(500); declare @dbsortorder varchar(100) set @dbsortorder='desc' declare @cols nvarchar(1000) set @cols=N'empno,ename,job,mgr,SAL' declare @size int set @size=4 SET @SQLString = N'select top(@size) '+ @cols + ' from emp where sal>Convert(varchar(100),@sal) order by ename '+ @dbsortorder; SET @ParmDefinition = N'@sal bigint,@cols nvarchar(100),@size int'; SET @sal= 2000; EXECUTE sp_executesql @SQLString, @ParmDefinition, @sal= @sal,@cols=@cols,@size=@size; end
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)