SQLTeam.com | Weblogs | Forums

Case Statement Involving #


Hi all, first post. I need a case statement to limit data. I have a text field (property) with SQL code in it. There are derive statements scattered throughout the larger text. I have isolated these derive statements using substrings and charindex. Some of the derive statements have been hashed out (#) so they are not actually being used. I know the charindex of the letter "d" for each of the derive statements so i tried "case when charindex('derive', property) -1 = char(35) then 'NotUsed' end as whatever". This did not find the derive statements with a preceding #. Why not? What would work? Thanks very much, tdsg


I'm an idiot! Figured it out.
"case when substring(property, (charindex('derive', property)) -1,1) = char(35) then "NotUsed" end as b"