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
 General SQL Server Forums
 New to SQL Server Programming
 Taking Values Different Table

Author  Topic 

zafarthesultan
Starting Member

16 Posts

Posted - 2009-12-15 : 01:22:21
Hi there.
I am new to SQL SERVER 2005. Here is my question.

There is a master table.
Another one is productlist table.

I am passing parameters to a stored procedure that inserts values into master table. One value productprice has to be fetched from productlist table. The parameter for product is productname and productprice is in productlist table.

So how can i fetch the productprice from productlist table and use it in my stored procedure using productname parameter passed to it. Please guide. Thanks

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-12-15 : 01:51:14
What is the relation between the two tables?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

zafarthesultan
Starting Member

16 Posts

Posted - 2009-12-15 : 02:52:16
There is no relation.
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-12-15 : 10:07:07
Maybe this??
declare @productprice decimal(10,2)
select @productprice = productprice
from productlist
where productname = @productname

Use @productprice in your INSERT statement
Go to Top of Page
   

- Advertisement -