Why does SQL Server 2000 treat SELECT test.* and SELECT t.est.* the same?
Posted
by Chris Pebble
on Stack Overflow
See other posts from Stack Overflow
or by Chris Pebble
Published on 2010-06-04T14:11:58Z
Indexed on
2010/06/14
21:42 UTC
Read the original article
Hit count: 183
tsql
|sql-server-2000
I butter-fingered a query in SQL Server 2000 and added a period in the middle of the table name:
SELECT t.est.* FROM test
Instead of:
SELECT test.* FROM test
And the query still executed perfectly. Even SELECT t.e.st.* FROM test
executes without issue.
I've tried the same query in SQL Server 2008 where the query fails (error: the column prefix does not match with a table name or alias used in the query). For reasons of pure curiosity I have been trying to figure out how SQL Server 2000 handles the table names in a way that would allow the butter-fingered query to run, but I haven't had much luck so far.
Any sql gurus know why SQL Server 2000 ran the query without issue?
Update: The query appears to work regardless of the interface used (e.g. Enterprise Manager, SSMS, OSQL) and as Jhonny pointed out below it bizarrely even works when you try:
SELECT TOP 1000 dbota.ble.* FROM dbo.table
© Stack Overflow or respective owner