Quantcast
Viewing latest article 2
Browse Latest Browse All 8

Problem with BCP

Hi Ramesh,

 Sorry for the delay, actually there is no such option in SQL Server. Inorder to get the result as you expect you have to cast your numeric type to varchar/nvarchar type.

Please check the below script:

create table producttbl( productname varchar(50), amount money)

insert into producttbl values('XXX',12.25)
insert into producttbl values('YYY',0.25)
insert into producttbl values('ZZZ', -0.87)

exec xp_cmdshell 'bcp "select productname, convert(varchar,amount) from dbname.dbo.producttbl" queryout D:\product.txt -c -T -t"|"'
Hope it solves your problem.
Kiran(CTS)

Viewing latest article 2
Browse Latest Browse All 8

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>