Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update from inner SQL
Message
From
01/03/2011 18:06:55
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Update from inner SQL
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01502274
Message ID:
01502274
Views:
95
I always thought that doing an update from a inner SQL, such as a massive update, was requiring the UPDATE line to use an alias. Basically, I always did something like this:
UPDATE TemporaryName
SET TemporaryName.MyField=5
FROM ParentTable AS TemporaryName
LEFT JOIN StatusTable ON TemporaryName.PrimaryKey=StatusTable.NoParentTable
WHERE something
But, if we do not use an alias, will this work as well:
UPDATE ParentTable
SET ParentTable.MyField=5
FROM ParentTable AS TemporaryName
LEFT JOIN StatusTable ON TemporaryName.PrimaryKey=StatusTable.NoParentTable
WHERE something
Because, when using an alias under SQL Anywhere, this does not work. In order to work with SQL Anywhere, we have to use the name of the table as is. Does this mean the alias usage is not SQL ANSI standard and that would be something that SQL Server would support by itself?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform