Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update from inner SQL
Message
De
01/03/2011 18:06:55
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Update from inner SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01502274
Message ID:
01502274
Vues:
96
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform