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
 SSIS and Import/Export (2005)
 XML Task Error

Author  Topic 

AKP2008
Starting Member

45 Posts

Posted - 2008-11-24 : 04:49:21
Hi,

I am New to SQL Server Integration services.

when i tried to export data to XML from ExecuteSQLtask i am getting below errors.

[XML Task] Error: An error occurred with the following error message: "Root element is missing.".
[XML Task] Error: Property "New Source" has no source Xml text; Xml Text is either invalid, null or empty string.

Please help me on how to solve below errors.

Thanks in Advance.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-24 : 04:57:43
this means that your xml is not well formed. as suggested by message it seems like it doesnt have a root element. how were you generating xml doc?
Go to Top of Page

AKP2008
Starting Member

45 Posts

Posted - 2008-11-24 : 05:11:35
quote:
Originally posted by visakh16

this means that your xml is not well formed. as suggested by message it seems like it doesnt have a root element. how were you generating xml doc?



I have Executesql task in that i am executing "select * from tablename" as sql statement.
save output into a variable. Here i am using Result set as 'XML'.

From this variable i have to Export the resultset into a XML file using XML Task.

For XML Task i am selecting Operation type as "Validate", sourcetype as "Variable" and source as 'variable used in executesqltask'.
Operation result is saved into a file connection.
here i am selecting validation type as "DTD" and FainonValidationFail as "False".

Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-24 : 05:23:46
cant you use like

select * from tablename for xml path ('yournodename'),ROOT('your root name')
Go to Top of Page

AKP2008
Starting Member

45 Posts

Posted - 2008-11-24 : 05:38:29
quote:
Originally posted by visakh16

cant you use like

select * from tablename for xml path ('yournodename'),ROOT('your root name')




can u please tell me what is meant by nodename and rootname. how can i use this?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-24 : 05:53:22
the name you give under nodename will come as name of xml node and root name will come as name of root for xml file.
Go to Top of Page

AKP2008
Starting Member

45 Posts

Posted - 2008-11-24 : 06:50:13
quote:
Originally posted by visakh16

the name you give under nodename will come as name of xml node and root name will come as name of root for xml file.



Still i am getting same error.

can u please tell me how can i view the result from "ExecuteSQLTask".
when the destination is a variable.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-24 : 07:13:38
whats the error you're getting?
b/w did you try this in sql mgmnt studio & see if you got any error?
Go to Top of Page

AKP2008
Starting Member

45 Posts

Posted - 2008-11-24 : 09:21:03
quote:
Originally posted by visakh16

whats the error you're getting?
b/w did you try this in sql mgmnt studio & see if you got any error?



when i run the below statement in SSMS

SELECT * FROM TABLENAME FOR XML PATH(''),ROOT('Root')

it ran successfully.

When i Export data from "ExecuteSQLTask" to XML file i am not able to get the data from above select statement.

Thanks in Advance.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-24 : 09:23:54
quote:
Originally posted by AKP2008

quote:
Originally posted by visakh16

whats the error you're getting?
b/w did you try this in sql mgmnt studio & see if you got any error?



when i run the below statement in SSMS

SELECT * FROM TABLENAME FOR XML PATH(''),ROOT('Root')

it ran successfully.

When i Export data from "ExecuteSQLTask" to XML file i am not able to get the data from above select statement.

Thanks in Advance.


are you trying this inside data flow tab. if yes, try OLEDB command task instead and see
Go to Top of Page

AKP2008
Starting Member

45 Posts

Posted - 2008-11-25 : 08:24:04
No i am doing this in Control flow tab.

Go to Top of Page
   

- Advertisement -