Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IN and char versus int
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Divers
Thread ID:
00833306
Message ID:
00833309
Vues:
16
This is a common question. That portion of the query is not parameterizable. You can get similar behavior by passing in the values in XML instead of a comma delimited list.

-Mike

>Threaders,
>
>Alter procedure dbo.pr_romtest_SelectTestStruc
> @tests char(180)
>as
>set nocount on
>select
>[id],
>[name],
>[tests]
>from romtest
>where
>[id] in (@tests)
>
>where id is integer and @tests is something like '4,5'
>I want: if id=4 or id=5 then condition is true
>I get: Sytax error converting the varchar value '4,5' to a column of data type int.
>
>Select * from romtest
>Where
>Id in (4,5)
>
>Works fine, but how can I alter my sp to work similarly?
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform