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
 General SQL Server Forums
 New to SQL Server Programming
 Insert question

Author  Topic 

BBrian
Starting Member

11 Posts

Posted - 2005-08-11 : 11:11:56
Hey,

I an't figure ot a way of making this work.. The statement should explain itself. I've tried a few variations but no joy!

insert into transmissions (ttype, ci_number) VALUES ('Connect Direct', (select ci_number from main where ci_name='Swift Alliance to intelliMATCH'))

Thanks

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2005-08-11 : 11:19:31
Try the following

insert transmissions (ttype, ci_number)
select 'Connect Direct', ci_number from main where ci_name='Swift Alliance to intelliMATCH'


------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2005-08-11 : 11:20:13
Declare @ci_Number int --(guessing on datatype)

Select @ci_number = (select ci_number from main where ci_name='Swift Alliance to intelliMATCH')

insert into transmissions (ttype, ci_number) VALUES ('Connect Direct', @ci_number)

Corey

Co-worker on The Wizard of Oz "...those three midgets that came out and danced, the freaked me out when I was little. But they are ok now."
Go to Top of Page

BBrian
Starting Member

11 Posts

Posted - 2005-08-11 : 11:25:36
Brilliant! ravilobos solution worked great. I haven't tried Seventhnights because the simpler one will be great (have to do this loads)

Thanks guys.
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2005-08-11 : 11:50:27
Glad that we could help. All the best to your SQL2K venture!

------------------------
I think, therefore I am - Rene Descartes
Go to Top of Page

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2005-08-11 : 12:53:06
quote:
Originally posted by BBrian

Brilliant! ravilobos solution worked great. I haven't tried Seventhnights because the simpler one will be great (have to do this loads)

Thanks guys.



i definitely agree that the other solution is simpler! i dont know what i was thinking

Corey

Co-worker on The Wizard of Oz "...those three midgets that came out and danced, the freaked me out when I was little. But they are ok now."
Go to Top of Page
   

- Advertisement -