all groups > sql server mseq > september 2003 >
You're in the

sql server mseq

group:

In XML, Converting Varchar list into tinyint list?



In XML, Converting Varchar list into tinyint list? Pankaj M
9/28/2003 11:04:13 PM
sql server mseq:


Hi
I am using VB.net/ASP.NET and SQL Server 2000 for asp.net application.

In following call to the procedure, I am passing a list of country ids.
In the procedure, I am opening up this xml and this list as varchar type
list. The column 'countrym_id' is a tinyint in tblProfileQ

Now, when I try to select rows in table tblProfileQ, it says, cannot
convert varchar to tiniyint, which I understand.

How do I turn varchar list to tinyint list ?


---call to the procedure----

EXEC sp_getLookupResults_quick
@xmlDoc =
'<Lookup>
<countrym_id>1,2,3</countrym_id>
</Lookup>'

------End call ------------

--------start procedure----------


ALTER procedure sp_getLookupResults_quick(@xmlDoc Text)
as
Begin

exec sp_xml_preparedocument @idoc OUTPUT, @xmlDoc

select
pq.countrym_id,
from tblProfileQ pq,
OPENXML (@idoc,'/Lookup',1) with
(
countrym_id varchar(120) 'countrym_id'
) as xm
where

pq.countrym_id in (xm.countrym_id)
;
End


--------end procedure----------

Please advice. Thanks in advance.

Pankaj


*** Sent via Developersdex http://www.developersdex.com ***
Re: In XML, Converting Varchar list into tinyint list? Anith Sen
9/29/2003 9:57:29 AM
For some ideas refer to:
http://www.algonet.se/~sommar/arrays-in-sql.html

--
- Anith
( Please reply to newsgroups only )

AddThis Social Bookmark Button