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)
 In Notation in Dynamic Stored Procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-04-15 : 08:04:47
Mary writes "Your example:

CREATE PROC Foo
@stringpassed
AS
BEGIN
DECLARE @SQL varchar(100)
SET @SQL = 'SELECT * FROM table WHERE idno IN ' + @stringpassed

EXEC(@SQL)
END

This appeared to be exactly what I needed, one problem is that my statement is over 2,000 characters long. Any suggestions?

I'm relatively new to stored procedures and I'm not a sql expert by any means. I was passing the string as '(1,2,3,4)' to be used in my where clasue as: MyField in (1,2,3,4)

Sql doesn't like it because it wants to convert the char to numeric.

Hoping that you can help....

Thanks in advance,

Over My Head"

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-04-15 : 08:07:04
Post what you are actually using.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -