473,387 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Passing multiple string selection to Store Procedure

Hi,

I'm try to pass a string to a variable in SQL Server, and
have that string used with "IN" clause to return multiple
results. This doesn't work. Can anybody help?

DECLARE @in_codes varchar(100)
Set @in_codes = char(34) + 'QFSWPA' + char(34) + ', ' +
char(34) + 'QFSWTR' + char(34)

SELECT COUNT(Certificate_Code) AS TotalInDomain
FROM OLCReports.RPDocentDataMart_User
WHERE Certificate_Code In (SELECT Certificate_Code
FROM OLCReports.RPDocentDataMart_User
WHERE (Certificate_Code IN (@in_codes))
GROUP BY Certificate_Code, userID)

Jul 19 '05 #1
1 1719
Take a look at this article by Erland Sommarskog
http://www.algonet.se/~sommar/arrays-in-sql.html

--
Ali Sanjabi

"Paul" <pa****@emergency.qld.gov.au> wrote in message
news:03****************************@phx.gbl...
Hi,

I'm try to pass a string to a variable in SQL Server, and
have that string used with "IN" clause to return multiple
results. This doesn't work. Can anybody help?

DECLARE @in_codes varchar(100)
Set @in_codes = char(34) + 'QFSWPA' + char(34) + ', ' +
char(34) + 'QFSWTR' + char(34)

SELECT COUNT(Certificate_Code) AS TotalInDomain
FROM OLCReports.RPDocentDataMart_User
WHERE Certificate_Code In (SELECT Certificate_Code
FROM OLCReports.RPDocentDataMart_User
WHERE (Certificate_Code IN (@in_codes))
GROUP BY Certificate_Code, userID)


Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Aaron | last post by:
The following code works fine when previewing a Crystal report using ASP, EXCEPT when it gets to a report using a SubReport and its associated parameters. The whole report just comes up blank with...
1
by: Paul | last post by:
Hi, I'm try to pass a string to a variable in SQL Server, and have that string used with "IN" clause to return multiple results. This doesn't work. Can anybody help? DECLARE @in_codes...
1
by: Andrew | last post by:
Hey all, I am very new to ASP.Net (and .Net in general), but that isn't stopping the boss from wanting to begin new projects in it. This latest project has me kinda stumped and after a couple...
4
by: Ranginald | last post by:
Hi, I'm having trouble passing a parameter from my default.aspx page to my default2.aspx page. I have values from a query in a list box and the goal is to pass the "catID" from default.aspx...
1
by: chariclark | last post by:
This may be a quick fix post... ---------------------------- I am having trouble passing multiple values into stored procedure. Here it is below: CREATE Procedure spGetAssociateds ( @PDSI...
1
by: SteveDouglas | last post by:
Hi all, I am currently writing an application in VB.NET that has a lot of controls (treeviews/listviews/labels and so forth) that represent "things" that need to be draggable from place to place,...
1
by: sheenaa | last post by:
Hello friends, I m using ASP.NET with C# 2005 and SQL SERVER 2005 for the ASP.Net Website. I m using sqldatasource to connect and retrieve the data from database and then it displays the data...
0
by: sharonrao123 | last post by:
hello all, I have a parent gridview company and in this one a nested gridview people, Is it possible to allow the user to select one row or multiple rows from the people gridview using a check box...
6
by: nzkks | last post by:
Hi I am using these: ASP.Net 2.0 with VB.Net, Visual Studio 2005, SQL Server 2005 I suspect, there is something missing in BLL class. I created the ASP.Net form also and checked whether it is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.