Hello,
I am desperatly trying to export a table from my sql server.
Using bcp I only have my csv file with . as decimal for all numbers (I also
tried the export wizard of the sql console).
Is there a way to obtain these figures with a comma , as decimal?
The ddl of the table is below and numbers are stored in :
[number_value] [float]
CREATE TABLE [dbo].[table] (
[id] [int] NOT NULL ,
[id2] [int] NOT NULL ,
[date_lo] [smalldatetime] NOT NULL ,
[number_type] [int] NOT NULL ,
[is_estimated] [varchar] (2) NULL ,
[number_value] [float] NULL ,
[date_value] [smalldatetime] NULL ,
[string_value] [varchar] (255) NULL ,
[number_int_value] [int] NULL
) ON [PRIMARY]
GO
Thanks in advance for your help.You can try DTS and edit the default transformation script to be like this
Function Main()
DTSDestination("id") = DTSSource("id")
DTSDestination("id2") = DTSSource("id2")
DTSDestination("date_lo") = DTSSource("date_lo")
DTSDestination("number_type") = DTSSource("number_type")
DTSDestination("is_estimated") = DTSSource("is_estimated")
DTSDestination("number_value") = replace(DTSSource("number_value"),".",",")
' Do replacement here
DTSDestination("date_value") = DTSSource("date_value")
DTSDestination("string_value") = DTSSource("string_value")
DTSDestination("number_int_value") = DTSSource("number_int_value")
Main = DTSTransformStat_OK
End Function
Is this what you need?
Thanks,
--
Mohamed Sharaf
MEA Developer Support Center
ITWorx on behalf Microsoft EMEA GTSC
<grille11@.yahoo.com> wrote in message
news:cni2ha$88a$1@.reader1.imaginet.fr...
> Hello,
> I am desperatly trying to export a table from my sql server.
> Using bcp I only have my csv file with . as decimal for all numbers (I
> also
> tried the export wizard of the sql console).
> Is there a way to obtain these figures with a comma , as decimal?
> The ddl of the table is below and numbers are stored in :
> [number_value] [float]
>
> CREATE TABLE [dbo].[table] (
> [id] [int] NOT NULL ,
> [id2] [int] NOT NULL ,
> [date_lo] [smalldatetime] NOT NULL ,
> [number_type] [int] NOT NULL ,
> [is_estimated] [varchar] (2) NULL ,
> [number_value] [float] NULL ,
> [date_value] [smalldatetime] NULL ,
> [string_value] [varchar] (255) NULL ,
> [number_int_value] [int] NULL
> ) ON [PRIMARY]
> GO
>
> Thanks in advance for your help.
>
>|||I have an error code: 0
description: Invalid use of Null: 'replace'
The first 40000 rows have a null value and the rest as a value with a
deciaml as .
Here is an example, the first row as no value and the one below has
1513.2527515762899 that need to be changed as 1513,2527515762899.
1;0;0;2004-02-27 00:00:00;3;0;N;;2004-02-27 00:00:00;;
1;1990;2;2003-01-09 00:00:00;5;0;N;1513.2527515762899;;;
"Mohamed Sharaf" <Mohamed.Sharaf@.egdsc.microsoft.com> wrote in message
news:uReyO5WzEHA.1292@.TK2MSFTNGP10.phx.gbl...
> You can try DTS and edit the default transformation script to be like this
> Function Main()
> DTSDestination("id") = DTSSource("id")
> DTSDestination("id2") = DTSSource("id2")
> DTSDestination("date_lo") = DTSSource("date_lo")
> DTSDestination("number_type") = DTSSource("number_type")
> DTSDestination("is_estimated") = DTSSource("is_estimated")
> DTSDestination("number_value") =
replace(DTSSource("number_value"),".",",")
> ' Do replacement here
> DTSDestination("date_value") = DTSSource("date_value")
> DTSDestination("string_value") = DTSSource("string_value")
> DTSDestination("number_int_value") = DTSSource("number_int_value")
> Main = DTSTransformStat_OK
> End Function
> Is this what you need?
> Thanks,
> --
> Mohamed Sharaf
> MEA Developer Support Center
> ITWorx on behalf Microsoft EMEA GTSC
>
> <grille11@.yahoo.com> wrote in message
> news:cni2ha$88a$1@.reader1.imaginet.fr...
>
没有评论:
发表评论