I was hoping to get some sample scripts for doing data conversions. Basically, I will be going into a clients database and map all of their data to our database and tables. Does anyone have a sample script of something like this where it shows some of the syntax with sending data from one database to another and matching specific columns up etc etc.
Basically mapping the data from their databases where when I put it in our databases it will match up...
ie fname = firstName in our database... but that is very limited. Like my last script to convert one table was
INSERT INTO [OurDatabaseName].[dbo].[OurTableName] (OurColumnName, OurColumnName2, OurColumnName3) SELECT TheirColumnName AS OurColumnName -- these columnms have same datatype , CAST(TheirColumnName2 AS VARCHAR(120)) AS OurColumnName2 , TheirColumnName3 AS OurColumnName FROM [TheirDataBase].[DBO].[TheirTableName]
This is a very basic example of the conversions I have done so far. Is there any other method that you would recommend looking into / script you can provide that might be easier on a bigger scale or more efficient?
Nope. It has to be dealt with on a column by column basis. Create a mapping sheet between source and destination and then apply data conversion accordingly. You can deal it generically.
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/