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
 Transact-SQL (2000)
 Insert data into a table

Author  Topic 

endx
Starting Member

1 Post

Posted - 2008-12-11 : 08:25:44
Hi all,
I've want to insert a record into table T2 from T1 and some other fields from the user. the followings are my tables with fields. T1(a,b,c,d) and T2(a,d,x,y,z). in table t2 the values of the fields must be:
a and d are the same in both tables
x = b-c
y, z are input from user/can be variables but not from table t1

is it possible to write sql statement that can handle this? like insert into t2 select a,b,c,d from t1.
pls help

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-12-11 : 08:31:30
insert into t2(a,d,x,y,z)
select a,d,b-c,@input1,@input2 from t1


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -