September 17, 2002 at 5:04 am
Hi,
I am passing an XML string which contains multiple records. I am trying to load the records into a cursor. Here is a sample code for the same
DECLARE fillidrefs_cursor CURSOR LOCAL READ_ONLY FAST_FORWARD FOR
SELECT USER_ID, USER_DESC
FROM OPENXML (@hdoc, '/root/ADM_USER')
WITH ADM_USER
This syntax works fine if I have not defined USER_ID as IDENTITY. But if I define the same column as IDENTITY, it gives me error "Invalid column name 'USER_ID'.
I want to load all the data into cursor and then loop through all records updating the user desc for each user id.
Is there any way by which I can load the cursor even if the IDENTITY is defined? Is there any solution or work around by which I can achieve this?
Thanks in advance.
Ash
September 18, 2002 at 1:17 am
Hi,
Found the solution.
Instead of using the table schema directly in the OPENXML, explicitly give the schema definition. So the statement will read something like this
DECLARE fillidrefs_cursor CURSOR LOCAL READ_ONLY FAST_FORWARD FOR
SELECT USER_ID, USER_DESC
FROM OPENXML (@hdoc, '/root/ADM_USER')
WITH ( USER_ID INT,
USER_DESC VARCHAR(30))
Thanks anyway.
Ash
September 18, 2002 at 4:55 am
Thanks for the follow up!
Andy
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply