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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Stored Procedures & Temp Variables...

Author  Topic 

mike55
Starting Member

15 Posts

Posted - 2004-07-20 : 12:19:08
Yo

Have created a procedure which allows me to add a new customer to my database. However before i add the customer i need to get a reference number for the customer from my reference table. To do that i have created a variable using the command

Declare @customer_ref int

I am then trying to set the value of @customer_ref to the value returned by my select statement.

Select reference_value from reference
where reference_name = "CustomerID"

I have tried letting my variable equals the select statement,
@customer_ref = "Select Statement..." and i have tried to do a select into the variable, however all attempts have failed.

Any suggestions??

Mike

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2004-07-20 : 12:21:22
Select @customer_ref = customer_RefCol From mytable...

Set @customer_ref = (Select Statement...)

Corey
Go to Top of Page
   

- Advertisement -