Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Proper syntax for bulk insert based on group by
Message
De
21/04/2015 09:29:19
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Proper syntax for bulk insert based on group by
Versions des environnements
SQL Server:
SQL Server 2012
Application:
Web
Divers
Thread ID:
01618857
Message ID:
01618857
Vues:
34
I have a select like this:
SELECT DetailMember.NoMember,DetailMember.NoView
 FROM DetailMember
 GROUP BY DetailMember.NoMember,DetailMember.NoView
This gives 272 records.

For each of those record, I need to insert a record in DetailMember.

The insert is as follow:
INSERT INTO DetailMember (AddUser,AddDate,ModUser,ModDate,NoMember,NoView,Enabled,NoDetail,Order)
 VALUES (1,'2015-04-19 17:17:47.000',1,'2015-04-19 17:17:47.000',PrimaryKeyFromAbove,PrimaryKeyFromAbove,1,7,99)
So, basically, I need to insert 272 records where two fields are from the select.

What would be the proper way to achieve that?
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