Author |
Topic |
adnanans78
Starting Member
17 Posts |
Posted - 2007-08-27 : 12:43:12
|
Hi,I m useing trigger on table.I get modification in the table by inserted virtual table.but when i try to store it in seperate table with addition more values to other attributes I give an error.Syntex is belowcreate trigger test on testfor insert,update,deleteasbegininsert chnages (getDate(),user_name(),select *from inserted)endit is not working rightly.any one help.thnx in advance |
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-08-27 : 13:02:45
|
Insert changes (sysdate, <other columnS> )select getdate(), *from insertedDinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-08-27 : 13:03:01
|
Basically, you need to list out the column names.Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-08-27 : 13:03:45
|
insert chnages (column list in correct order here )select getDate(),user_name(), otherColumnsInCorrectOrderHerefrom inserted_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-08-27 : 13:04:03
|
_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
adnanans78
Starting Member
17 Posts |
Posted - 2007-08-28 : 00:59:15
|
hi,Thnx for replies.how i can get current table which is modified and which trigger is fired?I set up some triggers on few tables.On the basis of trigger i will get data from the virtual tables.thnx in advance |
 |
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-08-28 : 22:15:01
|
You can find sample trigger code in books online. |
 |
|
adnanans78
Starting Member
17 Posts |
Posted - 2007-08-29 : 08:33:21
|
Hi,Thanx for reply,Is it possible that records can be inserted in to a table which contain collumns 20 from another table contain collumns 10.remaining collumn set value null automatically?Thnx in advance |
 |
|
adnanans78
Starting Member
17 Posts |
Posted - 2007-08-31 : 06:30:50
|
Hi,This is an other problem for me.I want the records which are modified or deleted at query execution time.Like virtual inserted or deleted tables do.These have limitation of data types.These tables could solve my problem if do not have such limitations.Is there any other way?thnx in advance. |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-08-31 : 07:15:59
|
no. not really.in sql server 2005 you have the output statement for this..._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|