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 2005 Forums
 Transact-SQL (2005)
 Counter on OpenXML Query

Author  Topic 

John Sourcer
Yak Posting Veteran

91 Posts

Posted - 2009-11-24 : 07:42:14
Hi Guru's,

I need a counter on an openxml query as follows:



SET @Counter = 1

UPDATE TblB SET TblB.Field = XML.Field, OrderID = @Counter FROM OPENXML(...




How can I increment the counter?

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-11-24 : 08:25:28
Hi

Try this..

SET @Counter = 1

UPDATE TblB
SET TblB.Field = XML.Field,
OrderID = @Counter,
@Counter = @Counter + 1
FROM OPENXML(...



-------------------------
R...
Go to Top of Page
   

- Advertisement -