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 |
khusiie
Yak Posting Veteran
78 Posts |
Posted - 2008-01-29 : 10:57:46
|
CREATE TRIGGER TriggermyorderstestON myorderstestINSTEAD OF INSERTAS DECLARE @COL_COUNT INTSELECT @col_count = COUNT(NUM) FROM myorderstestWHERE (NUM LIKE 'no%')if @col_count IS NOT NULL raiserror('cannot insert into table- trigger completed successfully',16,11) GOi have to create a temp table and apply the trigger to temptable Then i can insert some data into the temp table to see if it gets inserted into target table myorderstest...how can i do it? can anyone help me?Thanks |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-01-29 : 12:35:59
|
which is your temp table? you need to specify its name on trigger definitionCREATE TRIGGER TriggermyorderstestON yourtemptable |
|
|
khusiie
Yak Posting Veteran
78 Posts |
Posted - 2008-01-29 : 12:42:23
|
quote: Originally posted by visakh16 which is your temp table? you need to specify its name on trigger definitionCREATE TRIGGER TriggermyorderstestON yourtemptable
temp table is : #temptaborderbut i m getting error - it says taht u can't create trigger on temporary object...actually i want to create the trigger on one table - myorderstest: and want to see if it populates other table myorders.how can i do it?is it possible...that's why i tried temporary table but i think i am wrong..as trigger can't creat on temporary table...can u give me suggetion plz.thanks. |
|
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2008-01-29 : 15:19:41
|
quote: Originally posted by khusiie how to create trigger on temp table
Are you nuts?e4 d5 xd5 Nf6 |
|
|
|
|
|