Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing in Multiple complex PKs to Stored Procedure
Message
 
 
À
29/12/2015 07:45:36
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2012
Application:
Desktop
Divers
Thread ID:
01629332
Message ID:
01629377
Vues:
24
Hi Frank,

I've checked one of the SPs and in that SP we're passing info like this

Id,Quantity, DateTime;Id,Quantity,DateTime as varchar(max) string. For that we're using the following:
with  cteSource ( Data )
              as ( select  cast('<v><i>' + replace(replace(@cMbRedemptions, ';', '</i></v><v><i>'), ',', '</i><i>') +
                           '</i></v>' as xml) as Data
                 )
         insert   into #tblRedemptions
                  ( BenefitID,
                    Quantity,
                    Date_Time )
                  select   v.value('i[1]', 'INT') as BenefitID,
                           v.value('i[2]', 'INT') as Quantity,
                           v.value('i[3]', 'datetime') as Date_Time
                  from     cteSource as s
                           cross apply Data.nodes('v') as n ( v ) ;
I can check other samples as I know we do use XML in a few cases, I just need to recall where.
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