Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #837
| From | Pab <prabu.net88@gmail.com> |
|---|---|
| Newsgroups | comp.databases.ms-sqlserver |
| Subject | how to insert values in two table with single query |
| Date | 2011-11-24 05:27 -0800 |
| Organization | http://groups.google.com |
| Message-ID | <3dd607ca-010c-4e49-bde8-cef2d1ec603d@z22g2000prd.googlegroups.com> (permalink) |
Hi,
i am trying to insert data two table with single query with
foreign key reference but its not working
my query is
BEGIN TRANSACTION
DECLARE @salid int
Insert into sal_products (upc,shelf_number,aisle_no) values
('123asd','N/A','N/A','N/A','N/A',100)
select @salid = scope_identity()
insert into sal_product_locations (sal_product_id,side,position)
values (@salid,'N/A','N/A')
commit
could any one provide me solution for this
thanks,
-pab
Back to comp.databases.ms-sqlserver | Previous | Next — Next in thread | Find similar
how to insert values in two table with single query Pab <prabu.net88@gmail.com> - 2011-11-24 05:27 -0800
Re: how to insert values in two table with single query Erland Sommarskog <esquel@sommarskog.se> - 2011-11-24 13:53 +0000
Re: how to insert values in two table with single query Pab <prabu.net88@gmail.com> - 2011-11-24 06:13 -0800
Re: how to insert values in two table with single query "Bob Barrows" <reb01501@NOSPAMyahoo.com> - 2011-11-24 10:37 -0500
Re: how to insert values in two table with single query Erland Sommarskog <esquel@sommarskog.se> - 2011-11-24 23:35 +0100
Re: how to insert values in two table with single query --CELKO-- <jcelko212@earthlink.net> - 2011-11-25 08:22 -0800
csiph-web