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 |
|
eddie
Starting Member
45 Posts |
Posted - 2002-03-25 : 14:24:48
|
| I am writing a stored procedure where I will be passed a string. I then need to test for the existence of certain values in the string to see whether or not to execute certain parts of the sp. What is the best way to do this? Here is what I am currently doing..if exists (Select 3 from tablename where @test like '%4%')..but of course this doesn't work if the table is empty.For example, I will be passed 98745..if there is a seven in the string I execute a part of code, if there is a 4, I execute a different part.Thanks,EddieEdited by - eddie on 03/25/2002 14:27:51Edited by - eddie on 03/25/2002 14:29:53 |
|
|
setbasedisthetruepath
Used SQL Salesman
992 Posts |
Posted - 2002-03-25 : 14:33:57
|
You don't need to reference a table to make a comparison in t-sql. You can sayif @test like '%4%'begin {dml}endif you like.setBasedIsTheTruepath<O> |
 |
|
|
Jay99
468 Posts |
Posted - 2002-03-25 : 16:12:45
|
| Depending on what you are doing, you may be able to use CHARINDEX wrapped in a CASE . . . What do you know about page 47? There are few here that know?Jay<O> |
 |
|
|
|
|
|