Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 XML question! Stuck.

Author  Topic 

Tim F
Starting Member

35 Posts

Posted - 2005-04-04 : 11:12:20
Hi All,

I've got a table here (sims.sims_member) with person_id in it.
I need to loop through it and pass the xml to the stored proc.

How do I get this text into the local variable @personids ??
-----------------------------------------------------------------
declare @personids varchar(5000)

-- This is an example call
exec sims.att_pix_sync_student_marks_ATW625 @personids = '<data> <row person_id="1" /> <row personid="2" /></data> '

Thanks, Tim

Tim F
Starting Member

35 Posts

Posted - 2005-04-05 : 03:38:34
Does no-one know this??
Go to Top of Page

AndyB13
Aged Yak Warrior

583 Posts

Posted - 2005-04-05 : 04:32:18
You could try something like this


USE Northwind
GO

DECLARE @personids varchar(5000)

SELECT @personids = COALESCE(@personids + '"/>', '') + '<row person_id="' +
CONVERT(varchar(5),EmployeeID)
FROM Employees ORDER BY EmployeeID
SET @personids = '<data>' + @personids + '"/></data>'

PRINT @personids


Andy

Beauty is in the eyes of the beerholder
Go to Top of Page

Tim F
Starting Member

35 Posts

Posted - 2005-04-05 : 05:02:46
Thanks fella, that's v. helpful.
Go to Top of Page
   

- Advertisement -