Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parameter for IN ( '...', '...' )
Message
De
05/06/2007 07:34:53
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
05/06/2007 07:18:49
Aman Bains
Jaguar Computers
Jalandhar, Inde
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01230497
Message ID:
01230503
Vues:
20
This message has been marked as a message which has helped to the initial question of the thread.
>How do I send parameter to a stored procedure which expands to ['222','333']
>
>create procedure getMyVal @cPara varchar(50)
>as
>select * from <ctable> where id in (@cPara)
>
>calling
>
>cPara= "'222','333'"
>sqlexec(nHandle,"exec getMyVal ?cPara")
>
>I am not able to send an InList equivalent string to SQLserver SP. I want the parameter to contain something like '222','333' so that IN Clause works on multiple values.
>Can it work? Is there another way?

Aman,
Seeing SQLExec() there I assume this is a VFP question in fact. Yes there are better alternatives to IN query. Create a temp table, put your values in it and do a join. ie:
text to m.lcSQL noshow
create table #myValues (myvalue varchar (10))
insert into #myValues (myValue) values ('222')
insert into #myValues (myValue) values ('333')
select * from mytable t1 inner join #myValues t2 on t1.id = t2.myValue
endtext
SQLExec(m.lnhandle,m.lcSQL,'myResult')
If your configuration and security allows you might as well do a join with a VFP table using OpenRowSet().

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform