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.
Author |
Topic |
Amit-1234
Starting Member
19 Posts |
Posted - 2015-03-03 : 07:41:31
|
Hi,I want to insert a query generated XML resultset into a target table which has a column of datatype "XML". Please find the query as below:insert into [dbo].[SAMPLEXML]Select [EMPNO],[EmpFirst],[EmpSurname] from [dbo].[GW_MPOLA] FOR XML RAW ('Employee'), Root ('Emloyees'),elementsThis query is throwing the following error as below :Msg 6819, Level 16, State 1, Line 8The FOR XML clause is not allowed in a INSERT statement.Kindly help and suggest a possible solution |
|
ahmeds08
Aged Yak Warrior
737 Posts |
Posted - 2015-03-03 : 08:33:59
|
can you try this?insert into [dbo].[SAMPLEXML] select(Select [EMPNO],[EmpFirst],[EmpSurname] from [dbo].[GW_MPOLA]FOR XML RAW ('Employee'), Root ('Emloyees'),elements)Javeed Ahmedhttps://www.linkedin.com/pub/javeed-ahmed/25/5b/95 |
|
|
Amit-1234
Starting Member
19 Posts |
Posted - 2015-03-03 : 09:32:55
|
It worked. Thank you so much ..:) |
|
|
|
|
|