SQL Server Forums
Profile | Register | 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
 SQL SERVER trigger
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

manasbagde
Starting Member

India
11 Posts

Posted - 10/14/2010 :  12:24:53  Show Profile  Reply with Quote
Could some one let me know what the below trigger will do?

use default_epayments_db
CREATE TRIGGER EBS_Update_URL
ON
REQ
FOR INSERT
AS
BEGIN
IF EXISTS(SELECT RQ_REQUEST_ID, RQ_REQUEST_SERVER FROM REQ
WHERE RQ_REQUEST_SERVER = 'https://employeerequest-qa.emdeon.net/itg/')
BEGIN

update REQ set RQ_REQUEST_SERVER= 'http://10.145.176.21:8080/itg'

END
END


Regards,
Manas

--Manas

Kristen
Test

United Kingdom
22415 Posts

Posted - 10/14/2010 :  12:47:04  Show Profile  Reply with Quote
When a row(s) are inserted into table REQ, regardless of the values in that row(s), if a row exists in REQ where RQ_REQUEST_SERVER = 'https://employeerequest-qa.emdeon.net/itg/' then RQ_REQUEST_SERVER will be set to 'http://10.145.176.21:8080/itg' for every row in table REQ.

I very much doubt this is the intended behaviour (unless there is a constraint that only allows there to be one row in REQ table, or somesuch)

Edited by - Kristen on 10/14/2010 12:47:48
Go to Top of Page

manasbagde
Starting Member

India
11 Posts

Posted - 10/15/2010 :  02:46:26  Show Profile  Reply with Quote
Thanks Kristen

--Manas
Go to Top of Page

webfred
Flowing Fount of Yak Knowledge

Germany
8765 Posts

Posted - 10/15/2010 :  02:50:04  Show Profile  Visit webfred's Homepage  Reply with Quote
Sachin.Nand has already given a solution in this thread:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=151560

So what is your problem?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.17 seconds. Powered By: Snitz Forums 2000