Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 29th, 2006, 01:28 PM
Registered User
 
Join Date: Oct 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Stored Procedure

Dear All

I m facing a problem with Sql stored procedure.
I create a stored with @Key parameter and write a query in it Like

Select * From Table where key in ( @key)

It works fine when i Execute Sp like this

Exec Sp_Test '12345'

But when i pass a list of values from Vb to that parameter like

'1245','475','11445' in this case this gives me no result.

So pls advice me how can i pass this list into my SP parmeter form VB.

Regards
Kapil Kumar










 
Old October 30th, 2006, 12:50 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ahhhhh, the old "How to use an IN clause in a stored proc" puzzle.

Well, there are several ways to do this.

One way is to create a temporary table, populate the temporary table by parsing the values passed in the @Key parameter, and then use that temporary table in as select statement nested within your outer select statement.

I did a quick google and here is a link to an example:
http://www.codeproject.com/database/...&select=727155

Woody Z http://www.learntoprogramnow.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
stored procedure prashant_telkar SQL Server 2000 1 July 9th, 2007 07:57 AM
Stored Procedure jezywrap SQL Server ASP 1 January 3rd, 2007 12:29 AM
stored procedure kdm260 SQL Server 2000 2 June 19th, 2006 04:45 PM
Stored Procedure rajanikrishna SQL Server 2000 0 July 18th, 2005 05:01 AM
Help About Stored Procedure zhuge6 BOOK: ASP.NET Website Programming Problem-Design-Solution 3 May 20th, 2005 09:27 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.