> declare them before the AS?
The confusing bit is that it doesn't worry about the SELECT statements to
set the @list and @patternNUm variables.
It only screws up on the WHILE statement...
VERY CONFUSING!
Paul
> Okay...
>
> I am getting an error which says I haven't declared two
> variables. Whereas, the variables are declared directly above this.
>
> Here is the code:
>
> CREATE PROCEDURE spblah
>
> @lstblah varchar(1000)
>
> AS
>
> DECLARE @list varchar(1000)
> DECLARE @patternNum INTEGER
>
> SELECT @list = @lstblah
> SELECT @patternNum = CHARINDEX(',', @list)
>
> CREATE TABLE #mid (
> mid int NOT NULL
> ) ON [PRIMARY]
> GO
>
> WHILE (@patternNum > 0)
> BEGIN
> INSERT INTO #mid (mid) VALUES ( CAST(SUBSTRING(@list, 0,
> @patternNum) as int) )
> SELECT @list = SUBSTRING(@list, @patternNum + 1, Len(@list) -
> @patternNum)
> SELECT @patternNum = CHARINDEX(',', @list)
> END
>
> -- rest of Stored Procedure...
> GO
>
> Now it's telling me I haven't declared the variable @list and
> @patternNum, but not at the top, it's in the WHILE statement.
>
> Anyone?
>
> Paul
>
> -------------------------------------------
> Paul Johnston
> PJ Net Solutions Ltd
> http://www.pjnetsolutions.com
> [EMAIL PROTECTED]
> +44 (0)7866 573013
>
>
>
>
> --
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED] For human help, e-mail:
> [EMAIL PROTECTED]
>
> --
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED] For human help, e-mail:
> [EMAIL PROTECTED]
>
>
>
--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]