LINKED SERVER Stored procedure in sql server 2005

Posted by Dn2010 under Sql Server on 4/12/2012 | Points: 10 | Views : 1279 | Status : [Member] | Replies : 2
hi friends,

i want stored procedure in LINKED SERVER to below query and how to write calldate > latest date time


USE MYDB
INSERT INTO mytable(calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield)
select * from openquery(LNKMYVP,'SELECT DATE_FORMAT(calldate,''%Y%-%m-%d %H:%I:%s.000'') as calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield FROM mytable Order By calldate desc limit 100')




i create Linked server in sql server management studio 2005

mysql to sqlserver


LNKMYVP is Linked server Name,


how to use this below query using stored procedure and execute every time (1 hour) in job schedule.

please give the steps for and how to implement check the CALLDATE AFTER THE LATEST RECORDS IS INSERTED.



USE MYDB
INSERT INTO mytable(calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield)
select * from openquery(LNKMYVP,'SELECT DATE_FORMAT(calldate,''%Y%-%m-%d %H:%I:%s.000'') as calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield FROM mytable Order By calldate desc limit 100')


PLEASE GIVE THE SOLUTION


THANKS.




Responses

Posted by: Muhsinathk on: 6/19/2012 [Member] Bronze | Points: 25
Posted by: Muhsinathk on: 6/19/2012 [Member] Bronze | Points: 25

Login to post response