SQL Server dynamic stored procedure - passing parameter value to like search -
i have users
table categories
column delimited values.
i'm trying pass category , perform search users table in dynamic sql.
the category value paramterized.
declare @sqlquery nvarchar(4000) declare @paramdef nvarchar(2000) set @paramdef = '@category varchar(100)' set @sqlquery = 'update [u] set [u].[status] = 1 [dbo].[users] [u] [u].[categories] ?? execute sp_executesql @sqlquery ,@paramdef ,@category
i want search check %,@category,%
did try form query this?
declare @sqlquery nvarchar(4000) declare @paramdef nvarchar(2000) set @paramdef = '@category varchar(100)' set @sqlquery = 'update [u] set [u].[status] = 1 [dbo].[users] [u] [u].[categories] '''+ '%' + @category + '%' + '''' execute sp_executesql @sqlquery ,@paramdef ,@category
please let me know if helps. ashraf
Comments
Post a Comment