Importing table from SQL server to XML -


i trying import information sql server xml trying create .xml file in e drive. code shown below not working:

    create proc x         declare @xmloutput xml,             @myfile varchar(8000)       set @xmloutput= ( select top 1000 [tmc_code]                                 ,[measurement_tstamp]                                 ,[speed]                                 ,[average_speed]                                 ,[reference_speed]                                 ,[travel_time_minutes]                                 ,[confidence_score]                                 ,[cvalue]                                  [inrix_data].[dbo].[sample]                                  xml auto)      set @myfile='e:\britain.xml'      exec x 

you can use xp_cmdshell, , bcp utility achive this

exec xp_cmdshell 'bcp "select * mytable xml auto, elements" queryout "e:\mytablefile.xml" -c -t' 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -