Note that there are some explanatory texts on larger screens.

plurals
  1. POscaler variable not define
    text
    copied!<p>I am getting <code>scalar variable not define @cmdSQL</code> while trying to print my query to see what is d sql query is getting generating while running</p> <pre><code>print @cmdSQL = @cmdSQL + ' from server_des where title Like ''%'+@title+'%'' AND Description Like ''%'+@Description+'%'' AND Keywords Like ''%'+@Keywords+'%'' AND category Like ''%'+@Category+'%'' AND Location Like ''%'+@Location+'%''AND source Like ''%'+@Source+'%'' AND Date Like ''%'+@Date+'%' exec All_Searchnew1 'man','thief','ma','ma','ma','ma','12/12/2009',1,1,1,0,0,0,0,0 procedure Is written below... Alter PROCEDURE [dbo].[All_Searchnew1] @title nvarchar(max), @Description nvarchar(max), @Keywords nvarchar(max), @Category nvarchar(max), @Location nvarchar(max), @Source nvarchar(max), @Date nvarchar(50), @RD_btn_AND_OR AS BIT, @Chk_title AS BIT , @Chk_Description AS Bit , @Chk_Keywords AS BIT, @Chk_Category AS BIT, @Chk_Location AS BIT, @Chk_Source AS BIT, @Chk_Date AS BIT AS DECLARE @cmdSQL AS VARCHAR(2000) SET @cmdSQL = 'Select ' DECLARE @cmdCondition AS VARCHAR(2000) SET @cmdCondition = '' if @RD_btn_AND_OR = 1 Begin if (@Chk_title = 1) begin SET @cmdSQL = @cmdSQL + ' title,' SET @cmdCondition ='title Like ''%' + @title + '%''' end else begin SET @cmdSQL = @cmdSQL +'null as title' SET @cmdCondition ='title Like ''%' + @title + '%''' end if @Chk_Description &lt;&gt; 1 begin SET @cmdSQL = @cmdSQL + ' Description,' SET @cmdCondition ='Description Like ''%' + @Description + '%''' end else begin SET @cmdSQL = @cmdSQL +'null as Description' SET @cmdCondition ='Description Like ''%' + @Description + '%''' end if @Chk_Keywords &lt;&gt; 1 begin SET @cmdSQL = @cmdSQL + ' Keywords,' SET @cmdCondition ='Keywords Like ''%' + @Keywords + '%''' end else begin SET @cmdSQL = @cmdSQL +'null as Keywords' SET @cmdCondition ='Keywords Like ''%' + @Keywords + '%''' end if @Chk_Category &lt;&gt; 1 begin SET @cmdSQL = @cmdSQL + ' Category,' SET @cmdCondition ='Category Like ''%' + @Category + '%''' end else begin SET @cmdSQL = @cmdSQL +'null as Category' SET @cmdCondition ='Category Like ''%' + @Category + '%''' end if @Chk_Location &lt;&gt; 1 begin SET @cmdSQL = @cmdSQL + ' Location,' SET @cmdCondition ='Location Like ''%' + @Location + '%''' end else begin SET @cmdSQL = @cmdSQL +'null as Location' SET @cmdCondition ='Location Like ''%' + @Location + '%''' end if @Chk_Source &lt;&gt; 1 begin SET @cmdSQL = @cmdSQL + ' Source,' SET @cmdCondition ='Source Like ''%' + @Source + '%''' end else begin SET @cmdSQL = @cmdSQL +'null as Source' SET @cmdCondition ='Source Like ''%' + @Source + '%''' end if @Chk_Date &lt;&gt; 1 begin SET @cmdSQL = @cmdSQL + ' Date' SET @cmdCondition ='Date Like ''%' + @Date + '%''' end else begin SET @cmdSQL = @cmdSQL +'null as Date' SET @cmdCondition ='Date Like ''%' + @Date + '%''' end End --SET @cmdSQL = @cmdSQL + ' from server_des where title like ''%''' + @title + '''%'' AND Description Like '''%''+@Description+''%''' AND Keywords Like '''%''+@Keywords+''%''' AND category Like '''%''+@Category+''%''' AND Location Like '''%''+@Location+''%'''AND source Like '''%''+@Source+''%''' AND Date Like '''%''+@Date+''%'' --SET @cmdSQL = @cmdSQL + ' from server_des where title Like ''%' + @title + '%''or description like ''%'+@Description+'%''or keywords like ''%'+@Keywords+'%''or category like ''%'+@Category+'%''' SET @cmdCondition = @cmdCondition SET @cmdSQL = @cmdSQL + ' from server_des where ' + @cmdCondition EXEC(@cmdSQL) go </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload