Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Variable IN
Message
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Titre:
Divers
Thread ID:
00834228
Message ID:
01220921
Vues:
25
>>>It can be done in many ways (shown in the order of my personal preferences) :
>>>1. Using XML. See Re: IN and char versus int Thread #833306.
>>>2. Using fn_split() function from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsqlmag01/html/TreatYourself.asp to convert a list into a table and than use derived table in your select
>>>3. Use dynamic sql.
DECLARE @Sql nvarchar(4000)
>>>SET @Sql = 'SELECT ... WHERE column in (' + @ListParam + ')'
>>>EXECUTE(@Sql)
>>
>>Tip #2 could had saved me some hair a while back.... I ended up rolling my own udf for this.
>
>I also published ufn_Alines() in Utmag.

And at http://www.berezniker.com/display/SQL/Alines+UDF+-+String+Split
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