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 with no column list

Author  Topic 

Kristen
Test

22859 Posts

Posted - 2004-11-21 : 04:44:25
I did this by accident (i.e. no column list), shouldn't SQL have complained?

CREATE TABLE #TEMP
(
T_LineNo int IDENTITY(1,1) NOT NULL,
T_Text varchar(8000) NULL
)

INSERT INTO #TEMP -- (T_Text)
EXEC master..xp_cmdshell 'DIR C:\'

SELECT * FROM #TEMP ORDER BY T_LineNo

Kristen

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2004-11-21 : 05:42:58
Yeah, according to BOL it should have.

Obviously someone did something tricky and decided it was too hard to tell the documentation people



Damian
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-11-21 : 08:58:48
yeah that works if the columns in the return set are in correct order datatype-wise. otherwise no.



Go with the flow & have fun! Else fight the flow
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-11-21 : 12:29:47
Good answers!

A+ all round ...

(I guess I was just worried that I might goof-up and accidentally create this scenario, and then the next version of SQL would cause all my code to be broken. Now, if someone could have told be it was documented I would NOT have lost any sleep. Given teh actual responses ... "Bags under the eyes" anyone?!

Kristen
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2004-11-21 : 13:21:54
Given the nature of your query, maybe this is interesting:
Searching the filesystem

rockmoose
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-11-22 : 00:06:18
Blast! Wish I'd found that a couple of weeks ago ... apart from the ghastly cursors!

Kristen
Go to Top of Page
   

- Advertisement -