Wednesday, March 28, 2012

Query - check for a string in stored procedure

Hi,

I would like to check if a string value exist in a string in sql
server stored procedure, e.g.

set @.testString = 'this is my test document.'
if (@.testString contains 'test')
begin
....
end

How do I do this in sql server stored procedure?

Thanks,
June...try this

Declare @.testString varchar(100)
set @.testString = 'this is my test document.'
if charindex('test',@.testString)>0

begin
....
end

Madhivanan

No comments:

Post a Comment