Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Passing a sting of numeric values to a Stored Procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-07-19 : 12:56:09
Russ writes "Hello,

Here's my problem. I have the following stored procedure:

===========================================================

CREATE PROCEDURE [testSP]

@credList as varchar,
@credCount as numeric,
@skillsList as varchar,
@skillsCount as numeric

AS

select * from taxDirProfile where empID in
(select empid from taxDirData where empid in
(select empid from taxDirCredData where credID in (@credList) group by empid having count(*) = @credCount) and skillID in (@skillsList)
group by empid having count(*) = @skillsCount)

===============================================================

What is the syntax to call this stored procedure from Query Analyzer (SQL Srv 7.0)? If I replace the variables by hard coding the following values:

@credList = 3,4
@credCount = 2
@skillsList = 1,2
@skillsCount = 2

the SP returns the proper records. I've tried calling this SP in Query Analyzer using the following format:

testSP '3,4', 2, '1,2', 2

However, this does not return any records. I've created a much more simple SP that looks like:

===============================================================
CREATE PROCEDURE [tempSP]

@credList as varchar

AS

select empid from taxDirCredData where credID in (@credList)
===============================================================

SQL Srv will only evaluate the first character of the parameter. So if I call the SP like:

tempSP '456'
Please HELP! =)

Thanks in advance!

-rg"
   

- Advertisement -