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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert query 1

Status
Not open for further replies.

NeilV

Programmer
Oct 14, 2002
117
GB
Hello,

I am trying to write an SQL insert that gets some values from another table and some values created from elsewhere. What i would like to do is:
Code:
insert into table1
(Board,entity,info,value,clocked)
values('A','B','C',select value from table2 where info=123,getDate())

Is something like this possible - if so how?

Cheers,

Neil
 
Code:
insert into table1
(Board,entity,info,value,clocked)
select 'A','B','C', value, getdate()  
from table2 
where info=123
 
I thinks swampboogie may have misinterpreted what you want - if so and appologies if swampboogie hasnt ! try

insert into table1
(Board,entity,info,value,clocked)
values'A','B','C',(select value from table2 where info=123),getDate()

DBomrrsm
 
Thanks for that SwampBoogie,it did the trick!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top