i just need your help. I was looking for a solution, but nothing works yet.
I have to select multiple attributes from the xml-file which is stored in a column of my table.
This is the File:
<ManagerConfig>
<AccountList>
<Account accountID=“1“ friendlyName=“Testname1“> Test </Account>
<Account accountID=“2“ friendlyName=“Testname2“> Test </Account>
<Account accountID=“3“ friendlyName=“Testname3“> Test </Account>
<Account accountID=“4“ friendlyName=“Testname4“> Test </Account>
</AccountList
</ManagerConfig>
For this I´m using the following statement:
set @accountID = @xmlxx.value('(/ManagerConfig/AccountList/Account/@accountId)[1]', 'varchar(max)')
set @friendlyName = @xmlxx.value('(/ManagerConfig/AccountList/Account/@friendlyName)[1]', 'varchar(max)')
The result is:
accountID friendlyname
1 Testname1
When im changing the value from [1] to [2] im getting the second attribute. So thats no problem. But i need all of these attributes and export them into another temporary table. I thought i can replace the value with a variable [@i]:
set @accountID = @xmlxx.value('(/(ManagerConfig/AccountList/Account/@accountId)'[@i]'', 'varchar(max)')
But there is a syntax error:
An insufficient number of arguments were supplied for the procedure or function value.
I hope you can help me to find a solution..
Greetz Dennis