XML Clause is not allowed
-
Hello, I am executing the following script: use[SomeDatabase] DECLARE @TEST_XML TABLE (Column_XML XML) DECLARE @VAR VARCHAR(MAX) = 'EXECUTE dbo.sp_GetData 3229'; INSERT @TEST_XML EXEC (@Var) SELECT * FROM @TEST_XML any clues as to why I am receiving this error message, "The FOR XML clause is not allowed in a INSERT statement"? How can I get around this? I really just need to get this data into a temp table.
-
Hello, I am executing the following script: use[SomeDatabase] DECLARE @TEST_XML TABLE (Column_XML XML) DECLARE @VAR VARCHAR(MAX) = 'EXECUTE dbo.sp_GetData 3229'; INSERT @TEST_XML EXEC (@Var) SELECT * FROM @TEST_XML any clues as to why I am receiving this error message, "The FOR XML clause is not allowed in a INSERT statement"? How can I get around this? I really just need to get this data into a temp table.
iCanDivideByZero wrote:
any clues as to why I am receiving this error message
Because "dbo.sp_GetData" uses a
FOR XML
clause.iCanDivideByZero wrote:
How can I get around this?
Remove the XML clause.
iCanDivideByZero wrote:
I really just need to get this data into a temp table.
Than what's the use of using XML?
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]