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)
 Blank table name

Author  Topic 

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2003-12-02 : 06:28:58
Following query executes successfully in SQL2K.
create TABLE [ ] (emp_id int)
Sysobjects shows the entry for the above table.
Is it not odd to have table with name blank?



------------------------
I think, therefore I am

Amethystium
Aged Yak Warrior

701 Posts

Posted - 2003-12-02 : 07:00:38
It is not a blank, it is actually has a name of one single space. So you could do, SELECT * FROM [ ].

Weird but true.

________________
Make love not war!
Go to Top of Page

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2003-12-02 : 07:19:45
Yep. Is there any pericular use, having a table name with name as white space?

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

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-12-02 : 08:01:45
No.
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2003-12-02 : 08:41:36
Of course, if you actually try to create a table with an empty string as its name:

CREATE TABLE "" (emp_id int)

it tells you

Server: Msg 1038, Level 15, State 3, Line 1
Cannot use empty object or column names. Use a single space if necessary.
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near ''.

Ah, hours of endless fun:

CREATE TABLE " " (emp_id int)
CREATE TABLE " " (emp_id int)

DROP TABLE " "
DROP TABLE " "


Hmm, that doesn't actually copy into Query Analyzer properly...
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-12-02 : 19:38:36
hmmm.. "invisible" tables !!! i think we're on to something. this will REALLY make my code hard for the next guy to understand !

- Jeff
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2003-12-02 : 19:53:39
<Yoda>Invisible tables, prolong your contract they do. Drive others crazy, they will.</Yoda>

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

byrmol
Shed Building SQL Farmer

1591 Posts

Posted - 2003-12-02 : 19:56:11
You have got to have a name for relation. But you don't have to have attributes!

SQL does not allow nullary relations (relations with an empty heading ie: 0 attributes)

TABLE_DUM is a relation with an empty heading and empty body (Represents FALSE)
TABLE_DEE is a relation with an empty heading but 1 tuple. (Represents TRUE)


DavidM

"SQL-3 is an abomination.."
Go to Top of Page
   

- Advertisement -