dbTalk Databases Forums  

Subqueries

microsoft.public.sqlserver.clients microsoft.public.sqlserver.clients


Discuss Subqueries in the microsoft.public.sqlserver.clients forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Scott Morris
 
Posts: n/a

Default Re: Subqueries - 07-02-2003 , 07:48 AM






No - but the syntax must be correct.

insert into test (test_id, testStr)
select (select max(test_id) from test), 'something'
select * from test


"Jeremy Moncho" <jeremy.moncho (AT) bluewin (DOT) ch> wrote

Quote:
Hello!

Using on other DBMS I am today needing to do some work on Sql Server 2000.
My question is, are Subqueries "really" illegal in insert statements?

I am trying something in the following:

Create table test(
test id int,
testStr varchar(25)
)

Insert into test values ((select max(id) from test), 'something')


Thank you in advance for the assistance,

jeremy




Reply With Quote
  #2  
Old   
Vinodk
 
Posts: n/a

Default Re: Subqueries - 07-02-2003 , 09:58 AM






Can try using

Insert into test
select max(id), 'something' from test

--
HTH,
Vinod Kumar
MCSE, DBA, MCAD
SCT Software Solutions
http://www32.brinkster.com/sqlvinod


"Jeremy Moncho" <jeremy.moncho (AT) bluewin (DOT) ch> wrote

Quote:
Hello!

Using on other DBMS I am today needing to do some work on Sql Server 2000.
My question is, are Subqueries "really" illegal in insert statements?

I am trying something in the following:

Create table test(
test id int,
testStr varchar(25)
)

Insert into test values ((select max(id) from test), 'something')


Thank you in advance for the assistance,

jeremy


Reply With Quote
  #3  
Old   
Jeremy Moncho
 
Posts: n/a

Default Subqueries - 07-02-2003 , 04:34 PM



Hello!

Using on other DBMS I am today needing to do some work on Sql Server 2000.
My question is, are Subqueries "really" illegal in insert statements?

I am trying something in the following:

Create table test(
test id int,
testStr varchar(25)
)

Insert into test values ((select max(id) from test), 'something')


Thank you in advance for the assistance,

jeremy


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.