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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Trigger question

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-11-24 : 16:26:40
John writes "I have two tables.Table1 and Table2.Table2 has two columns. col1 and col2. I need to insert into table2 the id value of Table1 and a
constant value say '1' in col2,immediately upon inserting a row in
Table1.
My code is this.

Create trigger Insert_table2
on table1
For Insert
As
Begin
Select inserted.id from Inserted
Insert table2(col1,col2)select id from table1
But I do not know how to insert the constant value for col2.

Thanks!"
   

- Advertisement -