Friday, February 24, 2012

get primary key of last inserted record

Ok I know this might not be the most accurate place to post this but I know someone here has an answer for me on it.

I need to get the product_ID of the new record that is created by this insert statement

INSERT
INTO products
( class_ID,category_ID,product_name,product_desc,product_image,product_dimension,product_o1,product_o2,product_o3,product_ac,product_ph,product_photo )
SELECT class_ID,category_ID,product_name,product_desc,product_image,product_dimension,product_o1,product_o2,product_o3,product_ac,product_ph,product_photo
FROM products
WHERE product_ID = @.productID

The answer you seek is here:

http://www.mikesdotnetting.com/Article.aspx?ArticleID=54

No comments:

Post a Comment