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 |
|
smithsf22
Starting Member
9 Posts |
Posted - 2006-12-06 : 18:23:32
|
| Hello,I am trying to make a stored proc that will tell me if there are any rows in a table. The table name is a variable that I get at the start of the proc it is not sent in. What I am looking for in the table is sent into the stored proc.here is what i have so far but it does not work, i can not save it. It does not seem to allow me to use the if exists with variables. if exists (SELECT * FROM + @TableName + WHERE + @ColumnName + = + @SearchStr2)print 'got here ' +@TableName + ' '+ @ColumnName ENDThanks for any help |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2006-12-06 : 19:21:45
|
| You're right - it won't. Are you looking for a row count for the given table/search criteria? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-12-06 : 23:47:52
|
| www.Sommarskog.se/Dynamic_sql.htmlMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|