Goldfiles
05-21-2007, 04:43 PM
I want to run a 'SELECT' command on my database that will output a small table of data. About 3 rows and 3 columns. Can I set that 'SELECT' command to a @variable for later usage?
Something Like This? (doesn't work)
DECLARE @StatusTable varchar(100)
SET @variable = SELECT id, name, phone
FROM user_table
This is in MSSQL, btw. I'm new to MSSQL and I'm trying to figure out how I can set this table of data to a @variable so I can use it in a message later on in my code.
Something Like This? (doesn't work)
DECLARE @StatusTable varchar(100)
SET @variable = SELECT id, name, phone
FROM user_table
This is in MSSQL, btw. I'm new to MSSQL and I'm trying to figure out how I can set this table of data to a @variable so I can use it in a message later on in my code.
