Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT INTO

Status
Not open for further replies.

yogi77

Programmer
Oct 12, 2001
25
0
0
GB
HI,

I am trying to do something like this within a stored procedure using MS SQL7.0;

SELECT field1, field2, field3 INTO @var1, @var2, @var3 FROM table_name WHERE field1 = @passedinarg

However, without much joy. Is there a way of doing this or do I need to the long winded version;

SET @var1 = (SELECT field1 FROM table_name WHERE field1 = @passedinarg)

SET @var2 = (...etc

TIA,

Yogi
"Let us not condemn ignorance, let us condemn the reluctance to share"
 
I think it would look like this:

SELECT @var1 = field1, @var2 = field2, @var3 = field3 FROM table_name WHERE field1 = @passedinarg
 
Thanks CCTC1, that's exactly what I was trying to do. It's amaing how simple it looks when someone shows you. "Let us not condemn ignorance, let us condemn the reluctance to share"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top