Export Excel from SQL Server - data type changes - why? -


in project i'm exporting data sql server excel using following code

insert openrowset('microsoft.ace.oledb.12.0','excel 12.0  xml;hdr=no;database=d:\sathish\aa\gr_with_out_invoice;"imex=1";', select *  [sheet1$c1:r]')    select oi_comp,oi_majour_acc,oi_sub_acc ,oi_dept ,oi_air_line,oi_air_type,oi_air_mod ,oi_channel,oi_pro,oi_dir_ind,oi_res, case when cast(oi_deb numeric(32,0)) = 0 00 else cast(oi_deb numeric(32,0)), case when cast(oi_cre numeric(32,0))  = 0 null else cast(oi_cre numeric(32,0)) end ,oi_detail   ,oi_msg,''''   orcl_intg_macro_gr_without_invoice order  oi_pono,case when oi_comp = 'total' '1' else '0' end,case when oi_deb = 0  0 else 1 end 

in oi_cre , oi_deb numeric columns, when exporting, turn strings. how can export numeric numeric in excel?

i using sql server 2014.


Comments