Prev: Help With PIVOT - Please
Next: CTE and Case
From: Bart Holthuijsen on 23 Mar 2010 10:16 Hi group, Right now I'm busy migrating an old SQL Server 2000 SP4 database to 2008. I came across a query that worked in 2000, but not in 2008. I'm wondering why it worked all this time in 2000, because i.m.o. it should not. Here is a script that demonstrates the problem: CREATE TABLE dbo.T (ID INT) GO INSERT INTO dbo.T (ID) VALUES (1) INSERT INTO dbo.T (ID) VALUES (2) GO SELECT * FROM dbo.T INNER JOIN dbo.T T1 ON dboT.ID = T1.ID GO DROP TABLE dbo.T Note the ON part of the join. The dot between "dbo" and "T" is missing. SQL Server 2008 (rightly) complains: Msg 4104, Level 16, State 1, Line 4 The multi-part identifier "dboT.ID" could not be bound. Why does SQL Server 2000 accept this? For extra credit, also explain why "ON dboU.ID = T1.ID" does raise an error: Msg 107, Level 16, State 2, Line 1 The column prefix 'dboU' does not match with a table name or alias name used in the query. Kind regards, Bart Holthuijsen
|
Pages: 1 Prev: Help With PIVOT - Please Next: CTE and Case |