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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-12-11 : 07:56:54
|
| ROLLY writes "I am new to SQL programming. MSSQL server 7.0 I need to create a trigger for insert from one database to another. on a linked server.Here is something I am trying to do can you help?desperate. Can you help?? I want a trigger on a table called DAILYTRANS I need to insert from this query SELECT a.CAdvances, a.ScliNum, a.SCoNum, a.sLoanNum, b.sRepNum From Dailytrans a, dda b where a.ScliNum = b.ScliNumAND a.SCoNum = b.SCoNumAND a.sLoanNum = b.sLoanNumAND a.sCollectNum = "ADVRQS"FOR INSERT into a table called CASHINT that sits on a diifrent server and databaseBelow is what I was trying to do.CREATE TRIGGER TrgInsertAdvanceWiresON DailyTransFOR INSERTASBEGIN IF (SELECT count(1) FROM INSERTED) = 1BEGININSERT INTO [la-XRT].XRT.dbo.CASHINT(ins. SHELL_ID , TRANS_AMOUNT , TIME_STAMP)SELECT a.CAdvances, a.ScliNum, a.SCoNum, a.sLoanNum, b.sRepNum From Dailytrans a, dda b where a.ScliNum = b.ScliNumAND a.SCoNum = b.SCoNumAND a.sLoanNum = b.sLoanNumAND a.sCollectNum = "ADVRQS" IF @@ERROR <> 0 BEGIN ROLLBACK TRANSACTION RAISERROR(65001, 11, 1, "TrgInsertAdvanceWires", "Error on inserting AdvanceWires!") END END " |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-12-11 : 12:29:58
|
| So what isn't your trigger currently doing? Do you get an error?Tara |
 |
|
|
|
|
|
|
|