Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert value of Table1 into Table2 automatically

Status
Not open for further replies.

erixire

Technical User
Jun 4, 2002
72
CA
Hi,

I am totally new to sql server. I have this problem: When I make a new entry in a table (Table1, with a field "ID_number" of type 'int identity(1,1)'), I want this value (the ID_number) to be inserted automatically into another table (Table2). I browsed a lot on the internet for Sql Server Tutorials and I saw something called "Trigger". Is it the right tool to use? How can I use it to do what I want?

Thanks a lot.
 
Yes you want to use a trigger to make this happen.

Before you put the trigger onto the table look up create trigger in Books OnLine (The help file that comes with SQL). It covers what triggers are, the options, how to use them, and has some examples.

Denny

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(My very old site)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top