Last active
December 14, 2015 05:59
-
-
Save meganmcchesney/5039676 to your computer and use it in GitHub Desktop.
Insert Content into Content and ContentBridge use TSQL @@IDENTITY function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE CurtDev; | |
GO | |
--Create new ContentID for every T-Connector part in the Content table | |
--use last inserted identity value as variable, id | |
INSERT INTO Content(text, cTypeID) | |
VALUES ('Simple plug and play design eliminates the need for cutting or splicing', 2); | |
SELECT @@IDENTITY AS contentID | |
GO | |
--define a variable to hold contentID from Content | |
INSERT INTO ContentBridge (catID, partID, contentID) | |
VALUES(Null, 55027, 294474); | |
SELECT @@IDENTITY AS contentID; | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Each of these statements does the correct thing in my local db, however - I am inserting that value "55027" as a partID, which means running both statements 10 times for 282 parts. OUCH.
Any improvements you can suggest?