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 2008 Forums
 Transact-SQL (2008)
 Copy data from MySQL to MSSQL
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

2revup
Yak Posting Veteran

97 Posts

Posted - 11/12/2013 :  01:56:52  Show Profile  Reply with Quote
Guys I am developing a job that will copy data from MySQl to MSSQL, I have a few of them that are working well, but this one has me stumped as its not finding any data, yet when I query the table there is new data there when I refer to the dates there is a few hundred rows.

here is what the query looks like:

insert into [tempTest]
select * from openquery([support_cases],
'Select
o.comm_id,
parent_comm_id,
cc.case_id,
owner_agent_login,
owning_agent_login_id,
creating_agent_login_id,
resolver,
comm_type_code,
is_active,
is_Customer_sender,
email_queue_name,
primary_email_id,
comm_subject,
case_description,
Merchant_id,
alt_merchant_name,
response_sla_minutes,
severity,
TTR_Days,
case_status_name,
reason,
category_name,
case_type_name,
case_item_name,
comm_date_utc,
o.creation_date as comm_creation,
creation_date_utc,
case_start_date_utc,
o.last_updated_date as comm_last_updated,
cd.last_updated,
case_resolve_date_utc,
last_inbound_date_utc,
last_outbound_date_utc,
first_outbound_date_utc
FROM o_communications o
join o_case_communications as cc on o.COMM_ID=cc.COMM_ID
left join d_case_details cd on cc.case_id=cd.case_id
where comm_date_utc >= DATE_SUB(CURRENT_DATE(), INTERVAL 15 DAY)
and is_Customer_sender = ''Y''
and (cd.email_queue_name like ''support%'' or cd.email_queue_name like ''acme%'')
and cd.email_queue_name not like ''%-cs%''
and cd.email_queue_name not like ''%test%''
and cd.email_queue_name not like ''%trms%''
limit 6000000;
')t
where not exists (select 1
from [tempTest]
where comm_id = t.o.comm_id
)

go
I have tried cutting out many of the and clauses, but this is not the problem, as they seem to fit the bill when manually going through the data.
Any clues as to what this could be?

Edited by - 2revup on 11/12/2013 01:57:34

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 11/12/2013 :  02:04:50  Show Profile  Reply with Quote
are you sure the query returns data based on all the conditions?
Also t.o.comm_id doesnt seem to be valid syntax in sqlserver

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

2revup
Yak Posting Veteran

97 Posts

Posted - 11/12/2013 :  15:25:54  Show Profile  Reply with Quote
visakh16 your right the t.o.comm_id is not the correct syntax, it was me trying something out of frustrations. I had a deeper look at the data and it turns out I do have the latest, so problem solved.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 11/13/2013 :  07:54:30  Show Profile  Reply with Quote
ok..cool

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
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