CREATE PROCEDURE [dbo].[sp_empInfo] @empID int =null, @TesterName varchar(250)=null as declare @strSql nvarchar(4000) SET @strSql='Declare users_cursor CURSOR FOR SELECT ID,TesterName FROM emp Where Status=1 ' IF @empID IS NOT NULL AND LEN(@empID) > 0 SET @strSql = @strSql +' AND ID='+CAST(@empID AS NVARCHAR(10)) IF @TesterName IS NOT NULL AND LEN(@TesterName) > 0 SET @strSql = @strSql +' AND TesterName='+@TesterName exec sp_executesql @strSql open users_cursor fetch next from users_cursor into @empID, @TesterName while @@FETCH_STATUS = 0 BEGIN ---PROCESS fetch next from users_cursor into @empID, @TesterName END close users_cursor deallocate users_cursor
when i pass TesterName as Nil I'm getting Error Invalid column name 'Nil'
' AND ID='
' AND ID= '
' AND TesterName='
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)