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 |
|
bgross05
Starting Member
1 Post |
Posted - 2008-12-09 : 18:22:55
|
| I need a trigger to update the salary column of my table every time a new employee is entered. After inserting a new employee name and id into my table I've executed a statement to select the name, id, and salary but I'm getting two answers. The first being just salary of 1000 and the second showing the employee data I entered but salary has a null value. Can anyone explain what is wrong with my trigger?CREATE TRIGGER eugenem.tr ON eugenem.test AFTER INSERTAS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON;SET salary = 1000;WHERE empid = @empid; -- Insert statements for trigger hereENDGO |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-12-09 : 18:46:43
|
| Didn't get you question clearly? |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-10 : 02:20:24
|
| seems like what you need is just a default constraint on salary column to initialise to reqd value. |
 |
|
|
|
|
|