Thanks.But what i want exactly is i have to retrieve the 3 part after slash(/).
U have hard coded but i have to pass the parameter through sql server and retrieve the number.
Can u help me in this regard.
I have written a stored procedure:
Create procedure ParseArray ( @Array varchar(1000), @separator char(1) ) AS
set nocount on
-- @Array is the array we wish to parse
-- @Separator is the separator charactor such as a comma
declare @separator_position int -- This is used to locate each separator character
declare @array_value varchar(1000) -- this holds each array value as it is returned
-- For my loop to work I need an extra separator at the end. I always look to the
-- left of the separator character for each array value
set @array = @array + @separator
-- Loop through the string searching for separtor characters
while patindex('%' + @separator + '%' , @array) <> 0
begin
-- patindex matches the a pattern against a string
select @separator_position = patindex('%' + @separator + '%' , @array)
select @array_value = left(@array, @separator_position - 1)
-- This is where you process the values passed.
-- Replace this select statement with your processing
-- @array_value holds the value of this element of the array
select Array_Value = @array_value
-- This replaces what we just processed with and empty string
select @array = stuff(@array, 1, @separator_position, '')
end
set nocount off
GO
I am getting the result for (L/BNG/0153)as
Array_Value
----------
L
Array_Value
----------
BNG
Array_Value
----------
0153
But i dont know how to get them individually,this i am getting as an array.
|