Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Advanced SQL to update from insert
Message
De
25/01/2013 14:37:28
 
 
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:
01564137
Vues:
29
>I re-read your problem. I guess you want to grab PK from the Production version and put them in FK in the Version, right?
>
>I see the problem now, so
>
>create table #Output (Numero, [Date] datetime)
>
>insert into ...
>
>OUTPUT Inserted.Numero, Inserted.[Date] into #Output (Numero, [Date])
>select ....
>
>Update Version Set FK = O.Numero
>from Version INNER JOIN #Output O on Version.[Date] >= O.[Date] and Version.[Date] < dateadd(day,1, O.[Date])
Thanks, I will consider this approach for upcoming requests like that. I do not know if it is easier to understand however and SQL ANSI.
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform