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 |
|
SHIVPREET2K1
Starting Member
32 Posts |
Posted - 2008-06-23 : 08:20:07
|
| Dear Friends I am trying to create a trriger in sql server 2005 but it gives me error. i am unable to understand the problem . here is detail about itDatabase name :- Orderstable name :- Currency_MasterColumns are :- Currency_Symbol, Currency_Name, Value_in_RsThe create trigger query isCREATE TRIGGER FOR ORDERS ON CURRENCY_MASTERAFTER INSERTAS SELECT 'CURRENCY_SyMBOL'Can any body tell that why it gives an error and how to rectify it.Thanks in advance.Shivpreet2k1 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-23 : 08:21:52
|
Remove FOR & try.For is actually used in place of AFTERCREATE TRIGGER FOR ORDERS ON CURRENCY_MASTERAFTER INSERTAS SELECT 'CURRENCY_SyMBOL' |
 |
|
|
SHIVPREET2K1
Starting Member
32 Posts |
Posted - 2008-06-23 : 08:25:51
|
| thanks for the reply i done this as u have saidCREATE TRIGGER FOR ORDERS ON CURRENCY_MASTERAFTER INSERTAS SELECT 'CURRENCY_SyMBOL'now it gives the following errorMsg 156, Level 15, State 1, Line 1Incorrect syntax near the keyword 'FOR'.what could be possible reason for this strange behaviourThanks for ur reply shivpreet2k1 |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-23 : 08:31:45
|
quote: Originally posted by SHIVPREET2K1 thanks for the reply i done this as u have saidCREATE TRIGGER FOR ORDERS ON CURRENCY_MASTERAFTER INSERTAS SELECT 'CURRENCY_SyMBOL'now it gives the following errorMsg 156, Level 15, State 1, Line 1Incorrect syntax near the keyword 'FOR'.what could be possible reason for this strange behaviourThanks for ur reply shivpreet2k1
i told you to remove itCREATE TRIGGER ORDERS ON CURRENCY_MASTERAFTER INSERTAS SELECT 'CURRENCY_SyMBOL' |
 |
|
|
SHIVPREET2K1
Starting Member
32 Posts |
Posted - 2008-06-23 : 08:33:18
|
| Sorry bro you were right. it was my mistake. now the trigger is running fine.Thanks againshivpreet2k1 |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-23 : 08:36:07
|
quote: Originally posted by SHIVPREET2K1 Sorry bro you were right. it was my mistake. now the trigger is running fine.Thanks againshivpreet2k1
Ok. thats fine. and i assume that the posted trigger was for illustration. You dont require trigger to display some inserted field values. You can use OUTPUT clause for it. |
 |
|
|
|
|
|