Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 database migration

Author  Topic 

helixpoint
Constraint Violating Yak Guru

291 Posts

Posted - 2010-07-08 : 10:53:38
I am going to use a link server to transfer datafrom an Oracle db to MSSql DB. The issue is the field names are different. Can you give me a small sql example that would take it from one to the other?

Dave
Helixpoint Web Development
http://www.helixpoint.com

Kristen
Test

22859 Posts

Posted - 2010-07-08 : 13:23:21
[code]
INSERT INTO MS_SQL_Table
(
MsCol1, MsCol2, MsCol3, ...
)
SELECT OraCol1, OraCol2, OraCol3, ...
FROM LinkedOracleServer.OracleDatabase
[/code]
or replace "LinkedOracleServer.OracleDatabase" with
[code]
FROM OPENQUERY(LinkedOracleServer, N'SELECT OraCol1, OraCol2, OraCol3, ...
FROM OracleDatabase')
[/code]
Go to Top of Page

helixpoint
Constraint Violating Yak Guru

291 Posts

Posted - 2010-07-08 : 14:20:35
Ok. Thankyou. So how do you deal with MsCol1 if it is a primary key. This is my sql PKey is a primary Key

INSERT INTO Bond
(PKey, ModifyDate)
SELECT TOP (200) BONDAG_ID, CREATION_DATE
FROM RBDMS..FIX_DBA.BOND_AGREEMENTS AS BOND_AGREEMENTS_1
WHERE (BONDAGSTCD_ID = 4)

Dave
Helixpoint Web Development
http://www.helixpoint.com
Go to Top of Page
   

- Advertisement -