Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Advanced SQL to update from insert
Message
 
 
À
25/01/2013 14:35:08
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01564084
Message ID:
01564138
Vues:
32
>>It is part of the select columns list, in other words, you're selecting the PK from your version table using the above technique.
>
>After the first SQL, I execute another SQL like this:
>
>
>UPDATE Version SET NoVersionProduction=Temp2.Numero
>FROM Version
>JOIN
>(
>SELECT VersionProduction.Numero,VersionProduction.Date,Temp.Numero AS VersionNumero FROM VersionProduction
>INNER JOIN (SELECT CAST(Version.Date AS Date) AS Date,Version.Numero
>FROM Version
>WHERE Version.Date>'1899-12-30 00:00:00.000') Temp
>ON Temp.Date=CAST(VersionProduction.Date AS Date)
>) Temp2 ON Temp2.VersionNumero=Version.Numero
>
>
>This works.
>
>As for the CTE, it this SQL ANSI?

I believe CTE is SQL Server syntax, but it is probably supported in other databases.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform