Hi everyone,
I'm trying to load data from a database table to a text file using bcp on SQL Server 2000. When I'm loading the decimal values, the values before the decimal are not being loaded into the file. How could I load the values before decimals?
Here are the DDLs and DMLs of what I'm trying to run:
CREATE TABLE [dbo].[Product_Sales](
[Year_of_Sale] [smallint] NOT NULL,
[Product_Type] [varchar](25) NOT NULL,
[Product_Group] [varchar](25) NOT NULL,
[Category_Type] [varchar](25) NOT NULL,
[Category_Group] [varchar](10) NOT NULL,
[Product_Count] [bigint] NOT NULL,
[Product_Amount] [decimal](19, 2) NOT NULL,
[Category_Count] [bigint] NOT NULL,
[Category_Amount] [decimal](19, 2) NOT NULL,
CONSTRAINT [PK_Product_Sales] PRIMARY KEY CLUSTERED
(
[Year_of_Sale] ASC,
[Product_Type] ASC,
[Product_Group] ASC,
[Category_Type] ASC,
[Category_Group] ASC
) ON [PRIMARY]
) ON [PRIMARY]
INSERT INTO [Yearly_Sales].[dbo].[Product_Sales]
VALUES(2010, 'Online', 'Web', 'Cameras', 'Electronics', 547, 0.00, 0, 0.00)
EXEC [master].[dbo].[xp_cmdshell] 'bcp "SELECT * FROM [Yearly_Sales].[dbo].[Product_Sales]" queryout D:\Yearly_Sales\Product_Sales.dat -c -T -S'
And the output I see in the file is:
2010 Online Web Cameras Electronics 547 .00 0 .00
The values before decimals are being truncated.
Thanks,
Bangaaram
Known is a DROP, Unknown is an OCEAN.
No comments:
Post a Comment