Posts

Showing posts from August, 2019

SQL Server Insert Parent and Child Records with One Statement

Image
A few days ago, one of the developers asked me if that was possible to generate test data by performing multiple nested  INSERT statements , each of them involving inserting new rows into several parent tables and  in the same statement  reusing the autogenerated primary keys for the foreign key columns in the child table.  The developer was working with PostgreSql and so I tried to find a solution for both PostgreSql and SQL Server to learn the differences in the ANSI features implementation in these different database systems. Read the solution on my blogpost here:  https://www.mssqltips.com/sqlservertip/6142/sql-server-insert-parent-and-child-records-with-one-statement/ Yours, Maria P.S.  (Picture is taken from Kendra Little website)  

RIP SQLblog.com

Image
DBbest did their best but failed to maintain great knowledge sharing place where brightest SQL used to exchange new ideas and shared their wisdom. I want to thank Adam Machanic for giving me the opportunity to host my blog over there and be visible to the huge number of SQLblog readers. I will move my favourite articles over here if I succeed to find them. Yours, Maria