SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Data Conversion Samples
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

cstokes91
Yak Posting Veteran

USA
59 Posts

Posted - 12/20/2012 :  10:34:46  Show Profile  Reply with Quote
Hello,

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.

Thanks for any help,

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 12/20/2012 :  10:57:23  Show Profile  Reply with Quote
what are type of conversions you'll be doing? Is there a rule defined?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

cstokes91
Yak Posting Veteran

USA
59 Posts

Posted - 12/21/2012 :  15:41:27  Show Profile  Reply with Quote
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?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 12/21/2012 :  23:20:03  Show Profile  Reply with Quote
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/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000