in operator issue in sql server -
declare @ls_sql char(100) declare @sql varchar(max) set @ls_sql=ltrim('''stock in hand'',''store'',''product''') set @sql='select * item groupname in(' + rtrim(@ls_sql) + ')' print @sql execute @sql
result
select * item groupname in('stock in hand','store','product') msg 2812, level 16, state 62, line 9 not find stored procedure 'select * item groupname in('stock in hand','store','product')'.
this command
execute @sql
run procedure. if wan run dynamic sql should use below command:
exec (@sql)
you can use
execute sp_sqlexec @sql
Comments
Post a Comment