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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-05-03 : 08:38:00
|
| Scott writes "In an insert into statement how do you include additional values:Example:CREATE TRIGGER [trigger_BackupDeletes] ON dbo.docsINSTEAD OF DELETE AS BEGIN INSERT INTO Buckeye_SP_DELETED_DOCS.dbo.DeletedDocs SELECT * FROM dbo.docs where Id in (select Id from deleted) AND NOT type = 1 --add one more value datetime?The DeletedDocs table I'm inserting into has one more field in it called "Deleted_Date" that the Select "Doc" table doesn't have. How do i include along with this insert a last value of timestamp?" |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2005-05-03 : 09:22:58
|
| If it's a timestamp column then it should automatically update.Specify the column names first of all, in both your INSERT and SELECT parts, rather than just SELECT *. Then if your column does not auto-update you can use something likeSELECT col1, col2, col3, getdate() as col4 FROM blah-------Moo. :) |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2005-05-03 : 09:30:44
|
| timestamp....hmmmm....do you mean datetime...Is your background Oracle or DB2?Post the ddl of the tables.Where do you plan to get the additional data?Brett8-)EDIT: And you know that usingf INSTEAD of, it looks like you're leaving the row there...you sure you want that? |
 |
|
|
|
|
|