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 2008 Forums
 Transact-SQL (2008)
 Copy data from MySQL to MSSQL

Author  Topic 

2revup
Posting Yak Master

112 Posts

Posted - 2013-11-12 : 01:56:52
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?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-11-12 : 02:04:50
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
Posting Yak Master

112 Posts

Posted - 2013-11-12 : 15:25:54
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

52326 Posts

Posted - 2013-11-13 : 07:54:30
ok..cool

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

- Advertisement -