Click here to Skip to main content
15,917,329 members

Comments by Member 11923566 (Top 4 by date)

Member 11923566 20-Aug-15 14:19pm View    
if you could tell me that how to write the following query in vs2010
as above you have done...

DECLARE @CategoryName VARCHAR(200),
@Category_id INT
SET @CategoryName='singh1';
INSERT INTO tblCategory(CategoryName)
SELECT @CategoryName;
SELECT @Category_id= SCOPE_IDENTITY();
INSERT INTO tblProduct(ProductName, Category_id_FK, ProductCompany, ProductPrice, ProductQty)
SELECT 'rahul', @Category_id , 'verma', '15', '500';
Member 11923566 20-Aug-15 14:09pm View    
if you could tell me that how to write the following query in vs2010
DECLARE @CategoryName VARCHAR(200),
@Category_id INT
SET @CategoryName='singh1';
INSERT INTO tblCategory(CategoryName)
SELECT @CategoryName;
SELECT @Category_id= SCOPE_IDENTITY();
INSERT INTO tblProduct(ProductName, Category_id_FK, ProductCompany, ProductPrice, ProductQty)
SELECT 'rahul', @Category_id , 'verma', '15', '500';
Member 11923566 20-Aug-15 13:45pm View    
how to copy category_id from category table to category_id_fk from product table in this query
Member 11923566 20-Aug-15 13:28pm View    
thank you for your help @richard ... but i also want category_id from category table to be copied into category_id_fk in product table at here my sql query is working right but in your solution i am not able to do this