Thursday, June 16, 2005

 

Select 8 from [Table]

QUESTION:

I think there's a database corruption. The table is there, and I can insert rows without error, but when I select everything from the table all I get is this!


-----------
8
8
8
8
8
8
8
8

(8 rows affected)

What is going on, do we have a virus?

ANSWER:

Sorry it took me so long to answer, but it took me awhile to stop laughing.

No, there is no problem with the database. You fell victim to the most common typo in database history.

Observe.

1> create table TableA (a int)
2> go
1> insert into TableA values (1)
2> go
(1 row affected)
(repeat 8 times)
1> select 8 from TableA
2> go

-----------
8
8
8
8
8
8
8
8

(8 rows affected)

You probably meant "select * from TableA" but you didn't press the shift key, so you got "select 8 from TableA".

Comments:
chutiyapa
 
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?