Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Openquery with dynamic sql
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

zero1de
Posting Yak Master

Germany
105 Posts

Posted - 01/10/2013 :  05:59:07  Show Profile  Reply with Quote
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

India
52326 Posts

Posted - 01/10/2013 :  06:00:15  Show Profile  Reply with Quote
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/


Edited by - visakh16 on 01/10/2013 06:00:45
Go to Top of Page
  Previous Topic Topic Next 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.03 seconds. Powered By: Snitz Forums 2000