Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
bluestar
Posting Yak Master
133 Posts |
Posted - 2008-08-05 : 12:44:39
|
| Hello Can anyone please tell me how to use sql like query with variable.when I am doing thisSELECT SystemElementID,SETitleText,SESummaryText FROM SystemElement where SESummaryText LIKE '%history%'its executing fine.But when I doing thisALTER PROCEDURE [dbo].[sp_SystemSearch] @text as TextAS BEGIN SET NOCOUNT ON; SELECT SystemElementID,SETitleText,SESummaryText FROM SystemElement where SESummaryText LIKE @text ENDI am not getting any result.After executing it only shows table name and no result.Thank You |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-05 : 12:50:39
|
may be this:-ALTER PROCEDURE [dbo].[sp_SystemSearch]@text as TextASBEGINSET NOCOUNT ON;SELECT SystemElementID,SETitleText,SESummaryTextFROM SystemElementwhere SESummaryText LIKE '%' +@text + '%'END |
 |
|
|
bluestar
Posting Yak Master
133 Posts |
Posted - 2008-08-05 : 13:01:19
|
Thanks a TONS!!!! |
 |
|
|
|
|
|