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
 Inserting Records

Author  Topic 

websyd
Starting Member

16 Posts

Posted - 2006-07-11 : 09:45:49
hi im a beginner trying to build an application that needs the user to enter some data into a table named Delievary. This table is related to another table named Products. The Products table has the following columns :- ProductsId - PK
ProductName
ProductPrice
Delievary table has the following columns
:- DelivaryId - PK
QuantityRecieved
ProductId - FK
i know to select i have to use inner joins but to insert is what i dont really know about. Please help me out

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-07-11 : 09:48:18
something like this

insert into Products(ProductsId, ProductName, ProductPrice)
values (. . . )



KH

Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-07-11 : 09:48:38
I am not sure what you want to do?

Are you going to insert data into both products and Delivery tables?

If you are inserting in Delivery table only, it's just a simple Insert query !

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-07-11 : 09:49:56
You need to insert data in two tables seperately if neccessary


Madhivanan

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

websyd
Starting Member

16 Posts

Posted - 2006-07-11 : 10:10:42
each time a new consignment comes in to the warehouse the user has to insert records to show the goods recieved. i hav a drop downlist the reads the name of the products stored in the database this means i dont need to insert products again but i need to insert the quanties of this products into the delivary table
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-07-11 : 10:14:30
in this case just insert into the delivery table
example

insert into Delivery (DeliveryId, QuantityReceived, ProductId)
values (1234, 100, 1)



KH

Go to Top of Page
   

- Advertisement -