PDA

Click to See Complete Forum and Search --> : passing parameter


Sakana
Mar 19th, 2004, 08:54 PM
I have created the stored procedure but im having problems in passing the @ZoneSeatEnd to the @String. SET @String LIKE @ZoneSeatEnd ??? I know this is the wrong way of doing it. How should i do it?

alter proc spAscii(@ZoneSeatEnd varchar(1))
AS


SET TEXTSIZE 0
SET NOCOUNT ON
-- Create the variables for the current character string position
-- and for the character string.
DECLARE @position int, @String char(1)
-- Initialize the variables.
SET @position = 1
SET @String = 'J'

WHILE @position <= DATALENGTH(@String)
BEGIN
SELECT char(ASCII(SUBSTRING(@String, @position, 1))) as EndOfZoneSeat,
ASCII(SUBSTRING(@String, @position, 1)) as AsciiEndZone

SET @position = @position + 1
END

RETURN
SET NOCOUNT OFF
GO