March 23, 2011 at 12:39 pm
I have to migrate data into the table which has dependencies. I want to insert data into parent table by using Insert Into command. If I do that will it be inserted in child table as well?
Is there a rule i should follow?
Please advise
March 23, 2011 at 1:37 pm
beginner123 (3/23/2011)
I have to migrate data into the table which has dependencies. I want to insert data into parent table by using Insert Into command. If I do that will it be inserted in child table as well?
Only if you have a trigger that does it; otherwise you'll have to do it yourself.
Is there a rule i should follow?
Please advise
Keep it simple, and set-based.
You might want to look into the OUTPUT clause of the insert statement.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
March 23, 2011 at 1:57 pm
I am facing similar issues...Thank you so much.
March 24, 2011 at 12:36 pm
beginner123 (3/23/2011)
I have to migrate data into the table which has dependencies. I want to insert data into parent table by using Insert Into command. If I do that will it be inserted in child table as well?Is there a rule i should follow?
Please advise
Insert all the data into a staging table. Build a script that reads the staging table and inserts into the dependency tables first. Then when you insert into the main table, the dependencies will already exist.
______________________________________________________________________________
How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.
March 25, 2011 at 9:11 pm
Thank you for the info..
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply