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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing values from a table to stored procedures

Status
Not open for further replies.

charlise

Technical User
Oct 14, 2003
63
US
Hello,
Does anyone know how to pass values from a table as parameters to a stored procedure? For instance I have a stored procedure:

sp_Test_data(@db_name, @clientcode)

Then I have a table called Values that looks like the following:

DB Client
DB1 Client1

When I execute the stored procedure can I get it to look in the table and essentially say:

exec sp_Test_data 'DB1', 'Client1'
 
No
you have to do
declare @db_name varchar(50),@clientcode varchar(50)
select @db_name =DB,clientcode =from table
where DB ='DB1'

exec sp_Test_data(@db_name, @clientcode)




“I sense many useless updates in you... Useless updates lead to fragmentation... Fragmentation leads to downtime...Downtime leads to suffering..Fragmentation is the path to the darkside.. DBCC INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with you" --
 
Oops should be

No
you have to do
declare @db_name varchar(50),@clientcode varchar(50)
select @db_name =DB,@clientcode =Client
from table
where DB ='DB1'

exec sp_Test_data(@db_name, @clientcode)

“I sense many useless updates in you... Useless updates lead to fragmentation... Fragmentation leads to downtime...Downtime leads to suffering..Fragmentation is the path to the darkside.. DBCC INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with you" --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top