Well, you could using Dynamic SQL Jeff [quoted text, click to view] "Marina Levit [MVP]" <someone@nospam.com> wrote in message news:OE5asO2eGHA.3488@TK2MSFTNGP02.phx.gbl... > No. > > "João Santa Bárbara" <joaosb@i24portugal.com> wrote in message > news:ura6lM2eGHA.1264@TK2MSFTNGP05.phx.gbl... >> Hi all >> i have this query . >> Ex: "Select * from tblMove Where ID IN (1,2,3,4,5) and i want to replace >> the "1,2,3,4,5" with a parameter. >> is it Possible ?! >> >> thlks >> JSB >> >> > >
No. [quoted text, click to view] "João Santa Bárbara" <joaosb@i24portugal.com> wrote in message news:ura6lM2eGHA.1264@TK2MSFTNGP05.phx.gbl... > Hi all > i have this query . > Ex: "Select * from tblMove Where ID IN (1,2,3,4,5) and i want to replace > the "1,2,3,4,5" with a parameter. > is it Possible ?! > > thlks > JSB > >
Hi all i have this query . Ex: "Select * from tblMove Where ID IN (1,2,3,4,5) and i want to replace the "1,2,3,4,5" with a parameter. is it Possible ?! thlks JSB
On Fri, 19 May 2006 17:41:58 +0100, "João Santa Bárbara" [quoted text, click to view] <joaosb@i24portugal.com> wrote: >Hi all >i have this query . >Ex: "Select * from tblMove Where ID IN (1,2,3,4,5) and i want to replace >the "1,2,3,4,5" with a parameter. >is it Possible ?! > >thlks >JSB >
You could certainly replace the 1,2,3,4,5 with 5 parameters but I'm thinking you may not want that. Is it not possible to have the 1,2,3,4,5 be a select from some other table with a fixed number of parameters? In my cases, I always seem to be able to make that happen. Good Luck. Peter Kellner
Try this approach http://support.microsoft.com/default.aspx?scid=kb;en-us;555167 Since params are escaped, you're going to have to break the list apart at some point, but the above example I wrote does it in a fairly simple fashion and has been used quite a bit. If you have any questions, let me know. Cheers, Bill [quoted text, click to view] "João Santa Bárbara" <joaosb@i24portugal.com> wrote in message news:ura6lM2eGHA.1264@TK2MSFTNGP05.phx.gbl... > Hi all > i have this query . > Ex: "Select * from tblMove Where ID IN (1,2,3,4,5) and i want to replace > the "1,2,3,4,5" with a parameter. > is it Possible ?! > > thlks > JSB > >
That is what I meant. You pass it as a parameter, then use it in dynamic SQL. Obviously Jeff [quoted text, click to view] "Marina Levit [MVP]" <someone@nospam.com> wrote in message news:eEHhFEefGHA.1856@TK2MSFTNGP03.phx.gbl... > Right, but that wasn't the question. It was whether or not you could do it > as a parameter. > > "Jeff Dillon" <jeffdillon@hotmail.com> wrote in message > news:OmiPrg2eGHA.4828@TK2MSFTNGP05.phx.gbl... >> Well, you could using Dynamic SQL >> >> Jeff >> "Marina Levit [MVP]" <someone@nospam.com> wrote in message >> news:OE5asO2eGHA.3488@TK2MSFTNGP02.phx.gbl... >>> No. >>> >>> "João Santa Bárbara" <joaosb@i24portugal.com> wrote in message >>> news:ura6lM2eGHA.1264@TK2MSFTNGP05.phx.gbl... >>>> Hi all >>>> i have this query . >>>> Ex: "Select * from tblMove Where ID IN (1,2,3,4,5) and i want to >>>> replace the "1,2,3,4,5" with a parameter. >>>> is it Possible ?! >>>> >>>> thlks >>>> JSB >>>> >>>> >>> >>> >> >> > >
No, I actually enjoy string parsing, extra temp tables and some slightly complex T-Sql. I can babble stuff like "Another implementation involves using Table variables..." and all the new guys think I'm smart ;-) Probably ought to start spending my time getting good at LINQ instead ;-) [quoted text, click to view] "Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:ecsCBUafGHA.4892@TK2MSFTNGP02.phx.gbl... > Doesn't it suck - not being able to pass an array to sql server. > > -- > Miha Markic [MVP C#] > RightHand .NET consulting & development www.rthand.com > Blog: http://cs.rthand.com/blogs/blog_with_righthand/ > > "W.G. Ryan - MVP" <WilliamRyan@nospam.gmail.com> wrote in message > news:OBLCyfZfGHA.4304@TK2MSFTNGP05.phx.gbl... >> Try this approach >> http://support.microsoft.com/default.aspx?scid=kb;en-us;555167 >> >> Since params are escaped, you're going to have to break the list apart at >> some point, but the above example I wrote does it in a fairly simple >> fashion and has been used quite a bit. If you have any questions, let me >> know. >> >> Cheers, >> >> Bill >> "João Santa Bárbara" <joaosb@i24portugal.com> wrote in message >> news:ura6lM2eGHA.1264@TK2MSFTNGP05.phx.gbl... >>> Hi all >>> i have this query . >>> Ex: "Select * from tblMove Where ID IN (1,2,3,4,5) and i want to >>> replace the "1,2,3,4,5" with a parameter. >>> is it Possible ?! >>> >>> thlks >>> JSB >>> >>> >> >> > >
Doesn't it suck - not being able to pass an array to sql server. -- Miha Markic [MVP C#] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ [quoted text, click to view] "W.G. Ryan - MVP" <WilliamRyan@nospam.gmail.com> wrote in message news:OBLCyfZfGHA.4304@TK2MSFTNGP05.phx.gbl... > Try this approach > http://support.microsoft.com/default.aspx?scid=kb;en-us;555167 > > Since params are escaped, you're going to have to break the list apart at > some point, but the above example I wrote does it in a fairly simple > fashion and has been used quite a bit. If you have any questions, let me > know. > > Cheers, > > Bill > "João Santa Bárbara" <joaosb@i24portugal.com> wrote in message > news:ura6lM2eGHA.1264@TK2MSFTNGP05.phx.gbl... >> Hi all >> i have this query . >> Ex: "Select * from tblMove Where ID IN (1,2,3,4,5) and i want to replace >> the "1,2,3,4,5" with a parameter. >> is it Possible ?! >> >> thlks >> JSB >> >> > >
Right, but that wasn't the question. It was whether or not you could do it as a parameter. [quoted text, click to view] "Jeff Dillon" <jeffdillon@hotmail.com> wrote in message news:OmiPrg2eGHA.4828@TK2MSFTNGP05.phx.gbl... > Well, you could using Dynamic SQL > > Jeff > "Marina Levit [MVP]" <someone@nospam.com> wrote in message > news:OE5asO2eGHA.3488@TK2MSFTNGP02.phx.gbl... >> No. >> >> "João Santa Bárbara" <joaosb@i24portugal.com> wrote in message >> news:ura6lM2eGHA.1264@TK2MSFTNGP05.phx.gbl... >>> Hi all >>> i have this query . >>> Ex: "Select * from tblMove Where ID IN (1,2,3,4,5) and i want to >>> replace the "1,2,3,4,5" with a parameter. >>> is it Possible ?! >>> >>> thlks >>> JSB >>> >>> >> >> > >
Don't see what you're looking for? Try a search.
|