From: someone on
Hi,
I have uri query string in a database field like this:
com=123&user=234&order=01
com=123&user=234&order=02

how to parse the string and get each value:
com=123
user=234
order=01
com=123
user=234
order=02

Thanks...



From: mirthcyy on
If it's only three elements, you could use substring and charindex
like:

DECLARE @s varchar(1000)
DECLARE @s1 varchar(50)
DECLARE @s2 varchar(50)
DECLARE @s3 varchar(50)
SET @s='com=123&user=234&order=01'

SELECT @s1=LEFT(@s,CHARINDEX('&',@s)-1)
, @s2=SUBSTRING(@s, CHARINDEX('&',@s)+1, CHARINDEX('&',@s,
CHARINDEX('&',@s)+1)-CHARINDEX('&',@s)-1)
, @s3=RIGHT(@s, LEN(@s)-CHARINDEX('&',@s, CHARINDEX('&',@s)+1))
PRINT @s1
PRINT @s2
PRINT @s3

If there are more elements, you could write a loop to extract all
elements.



From: John Bell on
On Mon, 1 Mar 2010 15:56:14 -0500, <someone(a)js.com> wrote:

>Hi,
>I have uri query string in a database field like this:
>com=123&user=234&order=01
>com=123&user=234&order=02
>
>how to parse the string and get each value:
>com=123
>user=234
>order=01
>com=123
>user=234
>order=02
>
>Thanks...
>
>

Hi

This is a array/list with & as the delimited so you can adopt the
techniques from http://www.sommarskog.se/arrays-in-sql-2000.html

John
From: Uri Dimant on
Hmmm, I thought you want to parse me:-)))))


<someone(a)js.com> wrote in message
news:OghLjGYuKHA.4220(a)TK2MSFTNGP05.phx.gbl...
> Hi,
> I have uri query string in a database field like this:
> com=123&user=234&order=01
> com=123&user=234&order=02
>
> how to parse the string and get each value:
> com=123
> user=234
> order=01
> com=123
> user=234
> order=02
>
> Thanks...
>
>
>