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. I have tired to get this to run ever which way, without the + with the +' and just plane old +
if exists (SELECT * FROM + @TableName + WHERE + @ColumnName + = + @SearchStr2)
print 'got here ' +@TableName + ' '+ @ColumnName
END
Thanks for any help
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. I have tired to get this to run ever which way, without the + with the +' and just plane old +
if exists (SELECT * FROM + @TableName + WHERE + @ColumnName + = + @SearchStr2)
print 'got here ' +@TableName + ' '+ @ColumnName
END
Thanks for any help