| Author |
Topic |
|
billdng
Starting Member
17 Posts |
Posted - 2008-12-17 : 02:24:04
|
| dear all, I want to create a trigger on a table(TableA) to complete this function:when insert or update a record to TableA, if the record meet one condition,i want to put any info in app. that means the record can be saved and i only want to sent any info to user not error message.how can i do that in sql server ? can I use the function named raisError or other thing ?Thanks a lot . |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-17 : 02:26:19
|
What is "put any info in app."? E 12°55'05.63"N 56°04'39.26" |
 |
|
|
billdng
Starting Member
17 Posts |
Posted - 2008-12-17 : 02:34:12
|
[quote]Originally posted by Peso What is "put any info in app."?I mean to display any info in Application Level. Thanks. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-17 : 02:39:55
|
You can use RAISERROR with a severity level of 10 or 0. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
billdng
Starting Member
17 Posts |
Posted - 2008-12-17 : 02:46:29
|
[quote]Originally posted by Peso You can use RAISERROR with a severity level of 10 or 0.you mean i can use it like this: raiserror('info',10,0) ?is it right ? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-17 : 02:58:29
|
Try. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-17 : 02:59:22
|
quote: Originally posted by billdng [quote]Originally posted by Peso You can use RAISERROR with a severity level of 10 or 0.you mean i can use it like this: raiserror('info',10,0) ?is it right ?
can you explain what exactly is your scenario? |
 |
|
|
billdng
Starting Member
17 Posts |
Posted - 2008-12-17 : 06:13:30
|
quote: Originally posted by visakh16
quote: Originally posted by billdng [quote]Originally posted by Peso You can use RAISERROR with a severity level of 10 or 0.you mean i can use it like this: raiserror('info',10,0) ?is it right ?
can you explain what exactly is your scenario?
In one word,In a trigger of a table ,when i insert or update a record,if the record was inserted or updated successfully, i want to send any info message to User. for example,"It was Saved Succesfully!" . |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-17 : 06:15:50
|
You absolutely don't need a trigger for this!Use @@ROWCOUNT or even @@ERROR system variabled to see wether or not an INSERT was ok. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
billdng
Starting Member
17 Posts |
Posted - 2008-12-17 : 07:34:04
|
[quote]Originally posted by Peso You absolutely don't need a trigger for this!Use @@ROWCOUNT or even @@ERROR system variabled to see wether or not an INSERT was ok.That's only a sample sentence. what i really want is that : to sent any warning info to user in a trigger. It have to in a trigger .because i can't modify the application.Thanks |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-17 : 08:00:00
|
quote: Originally posted by billdng [quote]Originally posted by Peso You absolutely don't need a trigger for this!Use @@ROWCOUNT or even @@ERROR system variabled to see wether or not an INSERT was ok.That's only a sample sentence. what i really want is that : to sent any warning info to user in a trigger. It have to in a trigger .because i can't modify the application.Thanks
still you dont really need to use trigger just check @@ROWCOUNT and display success messageAlso check @@ERROR and use RAISERROR to display error messages. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-17 : 10:30:18
|
So what you REALLY want, but is not telling us, is that you want to send an email from a trigger whenever an updated or inserted records meets some criteria? E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|