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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Linked Server query Error from MySql to MS sql 200
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

poratips
Posting Yak Master

105 Posts

Posted - 06/18/2013 :  14:34:28  Show Profile  Reply with Quote
I created Linked server in Sql server 2005 and tried Data Migration from MySql to MS Sql 2005 but some of the data got rejetced and i need to find out that which data got rejected?
I was trying to use following query but looks like i am having correct syntex issue:

select * from OPENQUERY (MyLinkedServer, 'select * from CInfo
where ID NOt IN (select ID from Cinfo)')A

ID is my PK column, i have both the table name is same both the DB - MySql and MS Sql.
Only DB Name is different like - MySQLCInfoDB and in MS Sql - InfoSqlDB.

Thanks

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 06/19/2013 :  01:12:49  Show Profile  Reply with Quote
try the below first in MySQL query window and see whether its working fine

select * from CInfo
where ID NOt IN (select ID from Cinfo)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

bandi
Flowing Fount of Yak Knowledge

India
2224 Posts

Posted - 06/19/2013 :  02:06:36  Show Profile  Reply with Quote
-- I think that should be as follows:
select *
from MySQLCInfoDB..CInfo -- MySQL DB Table Name
where ID NOt IN (select ID from InfoSqlDB..Cinfo) -- MSSQL DB Table Name



--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 06/19/2013 :  02:17:00  Show Profile  Reply with Quote
in that case it should be this i guess

select * from OPENQUERY (MyLinkedServer, 'select * from CInfo')A
where ID NOT IN (select ID from InfoSqlDB..Cinfo)


as linked server query cant contain reference to sql server table.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

poratips
Posting Yak Master

105 Posts

Posted - 07/05/2013 :  10:12:54  Show Profile  Reply with Quote
Thanks both of you, i will try and see.
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