Get the App
SLTechnology News&Howtos  ›  Database  › 

How to use like sentence in sp_executesql

Shulou Source: shulou.com Published: 2022-05-31 19:25:33 11月14日 Update

Today, I will talk to you about how to use like in sp_executesql. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

Declare @ LikeSql nvarchar (32);-- define a like variable. If it is a stored procedure, the parameter set @ LikeSql = 'someword%';-- of the stored procedure can assign the LikeSql variable to'% xxxxxxxxxxxx%' declare @ SelectSql nvarchar (128)-- define the Sql statement and start spelling Sql set @ SelectSql = 'select * from Table where [Column] like @ LikePar' -use @ LikePar variable to parameterize exec sp_executesql @ SelectSql, N'@LikePar as varchar (32)', @ LikePar = @ LikeSql;-- to execute using sp_executesql

After reading the above, do you have any further understanding of how to use like in sp_executesql? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Tags: Content variables words parameters procedures storage more knowledge articles industry sentences information information channels channels enter one support related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Docker NVidia vpn Apple