C#
C#

help

Root Question Message

FR
FR11/9/2022
❔ SQL Server | How to format column using BCP?

#ask #bcp # sql server
hi,
so.... im using bcp to export data to excel and the query like this
select 
  date_create
  , code
into ##temp_table_a
from table b
join ....
where ...

set @sql='exec master..xp_cmdshell ''bcp "select * from '+'tempdb'+'..'+'##temp_table_a'+'" queryout "c:/xxx/xxx.xls" -c -T '''
exec(@sql)

but the code column format change from 202211070002 to 202208E+11 and i want the result like the first one, is there a way to change the format with BCP?

thank you ~

nb : lets say i dont want to use SSRS or some code stuffs
ContactFrequently Asked QuestionsJoin The DiscordBugs & Feature RequestsTerms & Privacy