![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
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 |
#4
| |||
| |||
|
|
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 |
#5
| |||
| |||
|
#6
| |||
| |||
|
|
in the above query i am trying to insert values to sal_products table and then i am taking that id using scope_identity and then i am trying to insert that id with some values in sal_product_locations table but is show some error near aisle_' which is error after that under score symbol thanks, -pab |
#7
| |||
| |||
|
|
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 |
#8
| |||
| |||
|
#9
| |||
| |||
|
|
actually i need mysql query only how can i perform insert data in two table with single query |
|
and i also need id from first table to insert that id to second table column sal_product_id |
|
pls provide me a solution |
![]() |
| Thread Tools | |
| Display Modes | |
| |