Ispirer Ispirer
 


Ispirer Home Page Ispirer SQLWays Product Page - Migration to SQL Server Request SQLWays

Four-part column references

Some statements required additional manipulations to be used in newer version of MSSQLServer 2008.

In SELECT statement

Microsoft SQL Server 2000:

SELECTFROM <database_name>.<schema_name>.<table_name>
WHERE <database_name>.<schema_name>.<table_name>.<column_name> =

Microsoft SQL Server 2008:

SELECTFROM <database_name>.<schema_name>.<table_name> <alias_name>
WHERE <alias_name>.column_name> =

Example:

Microsoft SQL Server 2000:

SELECT db1.dbo.tab1.col1 FROM db1.dbo.tab1 WHERE db1.dbo.tab1.col1 = 'aaa' 

Microsoft SQL Server 2008:

SELECT al.col1 FROM db1.dbo.tab1 al WHERE al.col1 = 'aaa' 

In UPDATE statement

Microsoft SQL Server 2000:

UPDATE <database_name>.<schema_name>.<table_name>
SETWHERE <database_name>.<schema_name>.<table_name>.<column_name> =

Microsoft SQL Server 2008:

WITH <alias_name> AS (SELECT * FROM <database_name>.<schema_name>.<table_name>)
UPDATE <alias_name>
SETWHERE <alias_name>.<column_name> =

Example:

Microsoft SQL Server 2000:

UPDATE dbo.ispirer.shop
SET good = "Milk"
WHERE dbo.ispirer.shop.good_id = 18

Microsoft SQL Server 2008:

WITH s AS (SELECT * FROM  dbo.ispirer.shop )
UPDATE s
SET good = "Milk"
WHERE s. good_id  = 18

Ispirer Home Page Ispirer SQLWays Product Page - Migration to SQL Server Request SQLWays

sqlways/sql-server/upgrade/statementssyntax/fourpartcolumn.txt · Last modified: May 07, 2018, 03:15:34 PM (external edit)
 
© 1999-2019, Ispirer Systems Ltd.
All Rights Reserved.  Privacy Statement