dcesharkman (10/22/2013)
Here is the output form the process that is needed:INSERT [dbo].[Address] ([ID], [Address1], [Address2], [City], [State], [ZipCode], [AddressTypeID], [IsPrimary], [CountryId], [Address_no_old]) VALUES (4, N'52123 Go Street', N'', N'Othertown', N'CA', N'92610', 73, 1, 741, NULL)
Where the function that creates this is the core of what I have not been able to convey
The catch is that the function needs to work for all tables in the database.
It is easy to get the Insert column list, data is the problem
Here is how they want to call ....
Table Key Key
Name Column Value
called by exec [dbo].GenerateSingleInsert 'dbo.CLPower', 'CLPowerId', 100
These values are used in the where clause
So do the destination and source tables have the same name and same exact ddl?
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/