| Author |
Topic |
|
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2011-04-22 : 09:23:36
|
| I need to add an "and" with the if, so if parm like '%1%' and '%0%'IF @Parameter LIKE '%1%'BEGININSERT INTO #TempTable (ColumnList)SELECT ColumnListFROM OffenderAddressSchoolENDDaveHelixpoint Web Developmenthttp://www.helixpoint.com |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-04-22 : 09:29:20
|
| IF @Parameter LIKE '%1%' and @Parameter LIKE '%0%'BEGININSERT INTO #TempTable (ColumnList)SELECT ColumnListFROM OffenderAddressSchoolENDJimEveryday I learn something that somebody else already knew |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-04-22 : 09:29:21
|
IF @Parameter LIKE '%1%' AND @Parameter LIKE '%0%'BEGININSERT INTO #TempTable (ColumnList)SELECT ColumnListFROM OffenderAddressSchoolEND Deadly 1 second sniper! |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-04-22 : 09:30:27
|
| You're just way too slow! Get that Yak blaster out!JimEveryday I learn something that somebody else already knew |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2011-04-22 : 09:31:12
|
| That's pretty fast on the draw!JimEveryday I learn something that somebody else already knew |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-04-22 : 09:32:36
|
| There's a thread somewhere with a zero-second snipe, I'll try and find it. |
 |
|
|
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2011-04-22 : 09:34:01
|
| too funny. Thanx guysDaveHelixpoint Web Developmenthttp://www.helixpoint.com |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
|
|
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2011-04-22 : 09:54:10
|
| This does not seem to be getting any data. What am I doing wrong?DECLARE @Parameter as varchar(100)set @Parameter = '1,2,5'CREATE TABLE #TempTable (street char(100),city char(50) )IF @Parameter LIKE '%1%' AND @Parameter LIKE '%0%'BEGININSERT INTO #TempTable (street, city)SELECT street, cityFROM OffenderSchoolInformationENDIF @Parameter LIKE '%4%' AND @Parameter LIKE '%0%'BEGININSERT INTO #TempTable (street, city)SELECT street, cityFROM OffenderEmploymentENDIF @Parameter LIKE '%5%' AND @Parameter LIKE '%0%'BEGININSERT INTO #TempTable (street, city)SELECT street, cityFROM OffenderSchoolInformationENDselect * from #tempTabledrop table #tempTableDaveHelixpoint Web Developmenthttp://www.helixpoint.com |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-04-22 : 09:56:32
|
| Well, you're specifying AND LIKE '%0%', but the parameter you're using doesn't contain a 0. Maybe you need OR instead of AND. |
 |
|
|
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2011-04-22 : 09:57:54
|
| Crap. needed an ORDaveHelixpoint Web Developmenthttp://www.helixpoint.com |
 |
|
|
|