declare
@Kol as cursor
if(len(@to_num)<>0)
begin
if(len(@to_num)<18)
begin
set @payam='error'
return
end
else
begin
if(LTRIM(RTRIM(@from_num)) = LTRIM(RTRIM(@to_num)))
set @StrSQL = 'Mashaghel.Code='' & LTRIM(RTRIM(@to_num)) & '''
else
begin
if (LTRIM(RTRIM(@StrSQL)) = '')
set @StrSQL = 'Mashaghel.Code<='' & LTRIM(RTRIM(to_num)) & '''
else
set @StrSQL = @StrSQL + ' AND Mashaghel.Code<='' & LTRIM(RTRIM(@to_num)) & '''
end
end
end
set @Kol=cursor for SELECT * FROM AvarezMashaghel WHERE am in (SELECT Code FROM Mashaghel Where + @StrSQL+ )
This code say error::
set @Kol=cursor for SELECT * FROM AvarezMashaghel WHERE am in (SELECT Code FROM Mashaghel Where + @StrSQL+ )
An expression of non-boolean type specified in a context where a condition is expected
How can I add string StrSQL
to SQL command ?