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
 General SQL Server Forums
 New to SQL Server Programming
 Openquery with dynamic sql

Author  Topic 

zero1de
Posting Yak Master

105 Posts

Posted - 2013-01-10 : 05:59:07
I have tried all the possibilities to write data on a MS SQL Server via trigger to a Oracle table.The only possible way is to use OpenQuery with dynamic SQL. But I just have no idea of dynamic SQL!

My question is who can help me to get a working dynamic SQL


CREATE TRIGGER [dbo].[TRG_INSUPDDEL_Tab] ON [dbo].[Tab]
FOR UPDATE, Insert, Delete
AS

insert into openquery([Server],'select DS_TYPE,DW_DOC_ID,DW_ARCHIVE, DW_MOD_DATE from User.T_SI_CHANGED_BK')
Select 'I' as DS_TYPE,
as DWDOCID,
as DW_DOC_ID,
as PRODUNIT,
as DW_ARCHIVE,
as DWMODDATETIME
from inserted

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-01-10 : 06:00:15
why do you need to do this via trigger? Does write to oracle has to happen in real time?
Also have you setup linked server connection to oracle?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -