VARCHAR TO DECIMAL

How can I conver this to a decimal
Query :Convert(varchar(5),[ICD-9-CM]) as [ICD-9-CM]
Current results: 4516
I need character length of 5   ##.##
YFLORES

You can do as below. But Is it always 4 length character? Whats the purpose of doing?Can you explain in detail?
Create table complete_Items([ICD-9-CM] varchar(2000))
Insert into complete_Items Select '4516'
Select Left(Convert(varchar(5),[ICD-9-CM]) ,2)+'.'+Right(Convert(varchar(5),[ICD-9-CM]),2)
From complete_Items
Drop table complete_Items

Similar Messages

  • Replace and convert varchar to decimal

    Hi all
    What could be the easiest way to replace and convert varchar(50) to decimal
    My string   '21 807,00'  Need to have it in db as  21807.00
    Thanks
    AKE

    On any version you can use somple convert with replace:
    declare @MyStr varchar(10) = '21 807,00'
    SELECT CONVERT(decimal(10,2), REPLACE(REPLACE(@MyStr, ',','.'),' ',''))
    but if there is a different format and the convert will not work, then you will get error. Therefore it is best (as mentioned) to use TRY_CONVERT on newer server or use Try block on old servers
    [Personal Site] [Blog] [Facebook]

  • Convert varchar to decimal - arithmetic overflow

    I'm using SQL Server 2014 and I'm trying to convert data from a staging table over to a production table. I seem to be getting an Arithmetic overflow error converting varchar to numeric on the decimal conversion. I'm sure I've overlooked something with the
    syntax of the CONVERT.
    This is the staging table:
    CREATE TABLE [dbo].[staging_table](
    [TimeIndex] [varchar](100) NULL,
    [Cluster] [varchar](100) NULL,
    [AvgMem] [varchar](100) NULL,
    [AvgCPU] [varchar](100) NULL,
    [TotalMemory] [varchar](100) NULL,
    [TotalCPU] [varchar](100) NULL,
    [Datacenter] [varchar](100) NULL,
    [vCenter] [varchar](100) NULL
    ) ON [PRIMARY]
    This is the prod table I'm moving it to:
    CREATE TABLE [dbo].[Clusters](
    [ClusterID] [int] IDENTITY(1,1) NOT NULL,
    [ClusterName] [varchar](25) NULL,
    [DatacenterName] [varchar](25) NULL,
    [TimeIndex] [datetime] NULL,
    [AvgCPU] [decimal](5, 2) NULL,
    [AvgMem] [decimal](5, 2) NULL,
    [TotalCPU] [decimal](8, 2) NULL,
    [TotalMem] [decimal](8, 2) NULL,
    [vCenterID] [int] NULL,
    CONSTRAINT [PK_Clusters_1] PRIMARY KEY CLUSTERED
    [ClusterID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    and here's an example INSERT INTO statement throwing the error:
    INSERT INTO [dbo].[Clusters] (ClusterName,DatacenterName,TimeIndex,AvgCPU,AvgMem,TotalCPU,TotalMem,vCenterID)
    SELECT SUBSTRING(Cluster,1,25) AS ClusterName,
    SUBSTRING(Datacenter,1,25) AS DatacenterName,
    CONVERT(datetime,TimeIndex,103) AS TimeIndex,
    CONVERT(decimal(5,2),AvgCPU) AS AvgCPU,
    CONVERT(decimal(5,2),AvgMem) AS AvgMem,
    CONVERT(decimal(8,2),TotalCPU) AS TotalCPU,
    CONVERT(decimal(8,2),TotalMemory) AS TotalMem,
    '3' FROM [dbo].[staging_table]
    Sample data is 0.00 to 100.00 in fields AvgCPU and AvgMem, and TotalCPU and TotalMem usually goes up to about 7 digits with no decimal (eg. 7543253) but could be 8 and although I've never seen a decimal I wouldn't rule it out so decided to account for it.
    I assume it's something I've overlooked with the syntax but any ideas would help.
    Thanks
    Adam

    The problem is your precision and scale you are assigning to your decimals.
    decimal(5,2) = this is a total of 5 digits, 3 digits for the whole number and 2 for the fractional.
    decimal(8,2) = this is a total of 8 digits, 6 digits for the whole number and 2 for the fractional. 
    So converting a varchar of 7 or 8 digits for TotalCPU or TotalMem will give you an error because your definition will actually only allow for 6 digits of storage. You could test this by doing decimal(8,0) or decimal(10,2) both which will allow for up to
    8 whole numbers.
    If you are worried about space Sql Server will allocate a set number of bytes for ranges based on the precision (first number in the parenthesis). See this page which explains in detail how much space each range takes up and also further details on
    decimal and numerics.
    -Igor

  • Convert varchar to decimal in insert statement

    Hi i need one help from you.
    can you please help me out
    I have one insert statement where i am inserting some values.
    first when i am inserting the values are fetched from 'xml' file...
    so in one of the xml file i have 'varchar' values which i need to convert to decimal and i need to insert.
    from the below script i need this conversion for "M.Item.query('./unitPrice').value('0.0','decimal(18,2)') unitPrice"
    could you suggest me on this.
    INSERT INTO BWBLineItemDetails_New(Transaction_GUID,Transaction_ID,LineItemNumber,Quantity,UnitPrice,ProductCode,Ship_From_Addr,Ship_To_Addr)
            SELECT
            @Transaction_GUID,
            @TransactionId,
             M.Item.query('./lineItemNumber').value('.','int') lineItemNumber,
              M.Item.query('./quantity').value('.','int') quantity,
              M.Item.query('./unitPrice').value('0.0','decimal(18,2)') unitPrice,
              M.Item.query('./unitPrice').value('.','decimal') unitPrice,
              M.Item.query('./productCode').value('.','nvarchar(100)') productCode,
              M.Item.query('./shipFromAddress/address1').value('.','nvarchar(255)') + '' +  M.Item.query('./shipFromAddress/address2').value('.','nvarchar(255)')shipFromAddress,
              M.Item.query('./shipToAddress/address1').value('.','nvarchar(255)') + '' +  M.Item.query('./shipToAddress/address2').value('.','nvarchar(255)')shipToAddressEdited by: 891933 on Dec 4, 2012 5:27 AM

    If this was Oracle, I would point you at the to_number function, but since you seem to be using MS Sql Server, I suggest you ask in a Microsoft soecufic forum.
    This is the forum for Oracle's SQL Developer tool.

  • Convert hh:mm varchar to decimal

    How do I convert varchar hh:mm (127:15) to a decimal (127.25)?
    Jeff

    <strike>
    may be just replace
    with t as (select '127:15' str from dual)
    select to_number(replace(str,':','.')) val
      from t</strike>
    Edited by: Karthick_Arp on Feb 15, 2010 7:43 AM
    my bad. dint read the OP properly. thanks to Massimo Ruocchio for pointing it out.

  • Convert data values in columns to another value based on a math formula

    ISSUE:
    I have a database of emergency incidents with descriptive data and longitude and
    latitude. I would like to make a google map out of the information but unfortunately
    the X Y coordinates are projected in Florida State Plane West in feet. Google maps
    requires WGS84 longitude and latitude in decimal degrees.
    PROBLEM:
    I have written some code in Transact SQL that will convert the values. But I am at a loss as to how to do the following:
    1.) plug in the X Y values from my database using an sql SELECT statement.
    2.) apply the formula to convert from State Plane to WGS84 to these X Y values
    3.) output the results.
    In other words, I have the data and I have the formula, but I am not figuring out how to plug the data into the formula and output the results. I am missing how to tie it all together.
    CODE:
    DECLARE @Easting DECIMAL(18,10);
    --SET @Easting = CAST(I_MapX AS DECIMAL(18,10));
    DECLARE @Northing DECIMAL(18,10);
    --SET @Northing = CAST(I_MapY AS DECIMAL(18,10));
    DECLARE @m2sft DECIMAL(10,10);
    SET @m2sft = 1200.0/3937.0;
    DECLARE @N0 DECIMAL(3,2);
    SET @N0 = 0.0;
    DECLARE @E0 DECIMAL(18,11);
    SET @E0 = 656166.6666666665;
    DECLARE @S0 DECIMAL(12,5);
    SET @S0 = 2692050.5001/@m2sft;
    DECLARE @K0 DECIMAL(18,18);
    SET @K0 = 0.9999411764705882;
    DECLARE @a DECIMAL(10,2);
    SET @a = 6378137.0/@m2sft;
    DECLARE @e DECIMAL(18,17);
    SET @e = 0.0818191911198883;
    DECLARE @ePrime DECIMAL(18,17);
    SET @ePrime = 0.08208852110265381;
    DECLARE @r DECIMAL(18,10);
    SET @r = 6367449.14577/@m2sft;
    DECLARE @V0 DECIMAL(15,12);
    SET @V0 = 0.005022893948;
    DECLARE @V2 DECIMAL(15,12);
    SET @V2 = 0.000029370625;
    DECLARE @V4 DECIMAL(15,12);
    SET @V4 = 0.000000235059;
    DECLARE @V6 DECIMAL(15,12);
    SET @V6 = 0.000000002181;
    DECLARE @L0 DECIMAL(4,2);
    SET @L0 = 82.0;
    DECLARE @w DECIMAL(18,10);
    SET @w = (@Northing - @N0 + @S0)/(@k0*@r);
    DECLARE @of DECIMAL(18,10);
    SET @of = @w + (sin(@w)*cos(@w))*(@V0 + @V2*power(cos(@w),2) + @V4*power(cos(@w),4) + @V6*power(cos(@w),6));
    DECLARE @Rf DECIMAL(18,10);
    SET @Rf = @k0*@a/sqrt((1 - power(@e,2)*power(sin(@of),2)));
    DECLARE @EPrime2 DECIMAL(18,10);
    SET @EPrime2 = @Easting - @E0;
    DECLARE @Q DECIMAL(18,10);
    SET @Q = @EPrime2/@Rf;
    DECLARE @tf DECIMAL(18,10);
    SET @tf = tan(@of);
    DECLARE @nf DECIMAL(18,10);
    SET @nf = @ePrime*cos(@of);
    DECLARE @B2 DECIMAL(18,10);
    SET @B2 = -0.5 * @tf * (1 + POWER(@nf,2));
    DECLARE @B4 DECIMAL(18,10);
    SET @B4 = -1/12*(5 + 3 * POWER(@tf,2) +POWER(@nf,2) * (1-9 * POWER(@tf,2)) - 4 * POWER(@nf,4));
    DECLARE @B6 DECIMAL(18,10);
    SET @B6 = 1/360*(61 + 90*POWER(@tf,2) + 45*POWER(@tf,4) + POWER(@nf,2)*(46 - 252*POWER(@tf,2) - 90*POWER(@tf,4)));
    DECLARE @Latitude DECIMAL(18,10);
    SET @Latitude = (@of + @B2*POWER(@Q,2)*(1 + POWER(@Q,2)*(@B4 + @B6*POWER(@Q,2))))*180/(PI());
    DECLARE @B3 DECIMAL(18,10);
    SET @B3 = -1/6*(1 + 2*POWER(@tf,2) + POWER(@nf,2));
    DECLARE @B5 DECIMAL(18,10);
    SET @B5 = 1/120*(5 + 28*POWER(@tf,2) + 24*POWER(@tf,4) + POWER(@nf,2)*(6 + 8*POWER(@tf,2)));
    DECLARE @B7 DECIMAL(18,10);
    SET @B7 = -1/5040*(61 + 662*POWER(@tf,2) + 1320*POWER(@tf,4) + 720*POWER(@tf,6));
    DECLARE @L DECIMAL(18,10);
    SET @L = @Q*(1 + POWER(@Q,2)*(@B3 + POWER(@Q,2)*(@B5 + @B7*POWER(@Q,2))));
    DECLARE @Longitude DECIMAL(18,10);
    SET @Longitude = (@L0 - (@L/cos(@of))*180/(PI()))*-1;
    SELECT
    I_EventNumber
    FROM Incident
    WHERE I_tTimeDispatch > 'May 7, 2012'
    SAMPLE DATA:
    Here is some raw data in order to get you started. Please notice the MapX and MapY
    coordinates are VARCHAR because they are Florida State Plane projections. The goal is
    to take these and turn them into WGS84 longitude and latitude expressed as decimal
    degrees to be used in Google maps. NOTE: I can convert from VARCHAR to DECIMAL. I just can't figure out where to plug my database columns into the sql query to output a result.
    CREATE TABLE Incidents
    I_EventNumber VARCHAR(20)
    I_MapY VARCHAR(15)
    I_MapX VARCHAR(15)
    INSERT INTO Incident
    VALUES
    (FCW69, 0815312, 0672298)
    , (FCW70, 0833311, 0697870)
    , (FCW71, 0807747, 0699684)
    , (FCW72, 0801252, 0689469)
    , (FCW73, 0853491, 0692350)

    Here's a way to get the results, all as part of a single extensive query (this would probably be more suited for defining a VIEW, where you could join on the input table with the VIEW to incorporate the computed values.
    If you instead had a business situation where you might need to execute this logic from many different places, rewriting as a user defined function might be better.  Anyway, for the answer plus a demonstration of the power of CROSS APPLY to generate
    interim working values...
    Create_Sample_Data:
    Declare @Incident TABLE
    I_EventNumber VARCHAR(20), I_MapY VARCHAR(15), I_MapX VARCHAR(15)
    INSERT INTO @Incident
    VALUES
    ('FCW69', '0815312', '0672298')
    , ('FCW70', '0833311', '0697870')
    , ('FCW71', '0807747', '0699684')
    , ('FCW72', '0801252', '0689469')
    , ('FCW73', '0853491', '0692350') /* This insert is SQL 2008 syntax only.. do multiple inserts or a UNION for 2005 */
    AsQuery:
    Select *
    from @INCIDENT
    Cross Apply
    Select
    N0 = 0.0,
    E0 = 656166.6666666665,
    K0 = 0.9999411764705882,
    e = 0.0818191911198883,
    ePrime = 0.08208852110265381,
    V0 = 0.005022893948,
    V2 = 0.000029370625,
    V4 = 0.000000235059,
    V6 = 0.000000002181,
    L0 = 82.0,
    Easting = CAST(I_MapX AS DECIMAL(18,10)),
    Northing = CAST(I_MapY AS DECIMAL(18,10))
    ) as CAStatic
    Cross Apply
    Select m2sft = 1200.0/3937.0,
    EPrime2 = Easting - E0
    ) as CAComputed1
    Cross Apply
    Select S0 = 2692050.5001/m2sft,
    r = 6367449.14577/m2sft,
    a = 6378137.0/m2sft
    ) as CAComputed2
    Cross Apply
    Select
    w = (Northing - N0 + S0)/(k0*r)
    ) as CAComputed4
    Cross Apply
    Select
    [of] = w + (sin(w)*cos(w))*(V0 + V2*power(cos(w),2) + V4*power(cos(w),4) + V6*power(cos(w),6))
    ) as CAComputed5
    Cross Apply
    Select
    Rf = k0*a/sqrt((1 - power(e,2)*power(sin([of]),2))),
    tf = tan([of]),
    nf = ePrime*cos([of])
    ) as CAComputed6
    Cross Apply
    Select
    Q = EPrime2/Rf,
    B2 = -0.5 * tf * (1 + POWER(nf,2)),
    B4 = -1/12*(5 + 3 * POWER(tf,2) +POWER(nf,2) * (1-9 * POWER(tf,2)) - 4 * POWER(nf,4)),
    B6 = 1/360*(61 + 90*POWER(tf,2) + 45*POWER(tf,4) + POWER(nf,2)*(46 - 252*POWER(tf,2) - 90*POWER(tf,4)))
    ) as CAComputed7
    Cross Apply
    Select
    Latitude = ([of] + B2*POWER(Q,2)*(1 + POWER(Q,2)*(B4 + B6*POWER(Q,2))))*180/(PI()),
    B3 = -1/6*(1 + 2*POWER(tf,2) + POWER(nf,2)),
    B5 = 1/120*(5 + 28*POWER(tf,2) + 24*POWER(tf,4) + POWER(nf,2)*(6 + 8*POWER(tf,2))),
    B7 = -1/5040*(61 + 662*POWER(tf,2) + 1320*POWER(tf,4) + 720*POWER(tf,6))
    ) as CAComputed8
    Cross Apply
    Select
    L = Q*(1 + POWER(Q,2)*(B3 + POWER(Q,2)*(B5 + B7*POWER(Q,2))))
    ) as CAComputed9
    Cross Apply
    Select
    Longitude = (L0 - (L/cos([of]))*180/(PI()))*-1
    ) as CAComputedLatLong
    Notice that each subsequent CROSS APPLY depends on a "working value" column being defined in some previous cross apply, or the working query.  There are a few other options, such as leaving off the very last Cross Apply, and computing Longitude as part
    of the main query at the beginning, but it works either way.
    EDIT: P.S. - By the way, this query is based on the formula in the original poster's query.  My formula matches that formula, and I bet it's right (as far as the lat/long conversion), but it could be the formula for Soylent Green, and I wouldn't know any
    better... :-)

  • Sun Java Studio enterprise 8 , problem when deployin CMP - pleas

    Hi , thank you for reading my post.I really stocked with this error
    I have a very odd problem here.
    I create a database table in Mysql
    Then i used Netbeans 4.1 / Sun studio Enterprise 8 to generate a CMP from the table (before this i register the driver and database innetbeans Databses node in runtime window), i did not change any setting
    My table has 4 field which one of them is : autoIncrement Integer + Primary ky
    two other fields are int varchar and decimal
    then i try to run the enterprise application .
    I pressed lovely f11
    and it Stoped with error .
    here is the error messege :
    Deploying application in domain failed; Fatal Error from EJB Compiler -- JDO74046: JDOCodeGenerator: Caught a MappingConversionException loading or creating mapping model for application 'ejblearn' module 'ejblearn-EJBModule': JDO71030: There is no column in table learn which can be used to support the servers implementation of unknown key classes.
    ; requested operation cannot be completed
    I should notice that deployment progress monitor shows the same message in red Color)
    Is it application server problem ?
    why sun does not make it simpler?
    I found that too many post are about this problem without any response
    There is just one workaround which does not works / is too ugly

    Does the MSQL database have a primary key, the CMP wizard determines the primary key based on the primary key setup on the database. The primary key which is selected can be detemined using the database browser Runtime->Database, this displays meta data information from the specified databases.

  • No scientific notation in csv file

    Hi, All
    I have a package is extracting data from DB to CSV file.
    And I made up a column like '48484848484848484', when I load this column into CSV file,
    it shows me scientific notation along with the data.
    How can I get rid of the scientific notation ?
    I've tried data conversion, derived column. Nothing works.
    This really makes my frustrated.
    Thank you in advance.

    Hi,
    In that case, the SQL export process is fine.
    It's just Excel suggesting a scientific notation where it's not needed.
    You can get rid of the scientific notation by forcing your "long" numeric value into a string.
    For example
    "A001","Item code", "123376265892759026"
    instead of
    "A001", "Item code", 123376265892759026
    Sebastian Sajaroff Senior DBA Pharmacies Jean Coutu
    My data souce is like:
    Select '1234567891123' as column1,
              Id  as column2,
                          Name as column3,
    From Table1
    I think I already give column1 as a string. And I also tried to cast column1 to nvarchar or varchar or decimal or numeric, nothing works.

  • Varchar to 2 decimal points ?!

    Hi,
    I have the below code; which I need to set the Line Total to 2 decimal points but it is a varchar since I want to attach the currency symbol to it:
    {CASE
                        WHEN T0.DocCur = 'EUR' THEN CONVERT (varchar(50), T0.DocCur) + ' ' + CONVERT (varchar(50), T1.LineTotal)
                        ELSE CONVERT (varchar(50), T0.DocCur) + ' ' + CONVERT (varchar(50), T1.TotalFrgn)
              END as 'Line Total'}
    Appreciate your help.
    Thanks

    First round your line total and other numeric fields and then do your convert.
    CONVERT (varchar(50), ROUND(T1.LineTotal, 2))

  • External table.How to load numbers (decimal and scientific notation format)

    Hi all, I need to load inside an external table records that contain 7 fields. The last field is called AMOUNT and it's represented in some records with the decimal format, in others records with the scientific notation format as, for example, below:
    CY001_STATU;2009;Jan;11220020GR;'03900;CYZ900;-9,99999999839929e-03
    CY001_STATU;2009;Jan;11200100;'60800;CYZ900;41380,77
    The External table's script is the following:
    CREATE TABLE HYP_DATA
    COUNTRY VARCHAR2(50 BYTE),
    YEAR VARCHAR2(20 BYTE),
    PERIOD VARCHAR2(20 BYTE),
    ACCOUNT VARCHAR2(50 BYTE),
    DEPT VARCHAR2(20 BYTE),
    ACTIVITY_LOC VARCHAR2(20 BYTE),
    AMOUNT VARCHAR2(50 BYTE)
    ORGANIZATION EXTERNAL
    ( TYPE ORACLE_LOADER
    DEFAULT DIRECTORY HYP_DATA_DIR
    ACCESS PARAMETERS
    ( RECORDS DELIMITED BY NEWLINE
    BADFILE 'HYP_BAD_DIR':'HYP_LOAD.bad'
    DISCARDFILE 'HYP_DISCARD_DIR':'HYP_LOAD.dsc'
    LOGFILE 'HYP_LOG_DIR':'HYP_LOAD.log'
    SKIP 0
    FIELDS TERMINATED BY ";"
    MISSING FIELD VALUES ARE NULL
    REJECT ROWS WITH ALL NULL FIELDS
    "COUNTRY" Char,
    "YEAR" Char,
    "PERIOD" Char,
    "ACCOUNT" Char,
    "DEPT" Char,
    "ACTIVITY_LOC" Char,
    "AMOUNT" Char
    LOCATION (HYP_DATA_DIR:'Total.txt')
    REJECT LIMIT UNLIMITED
    NOPARALLEL
    NOMONITORING;
    If, for the field AMOUNT I use the datatype VARCHAR (as above), the table is loaded but I have some records rejected, and all these records contain the last field AMOUNT with the scientific notation as:
    CY001_STATU;2009;Jan;11220020GR;'03900;CYZ900;-9,99999999839929e-03
    CY001_STATU;2009;Feb;11220020GR;'03900;CYZ900;-9,99999999839929e-03
    CY001_STATU;2009;Mar;11220020GR;'03900;CYZ900;-9,99999999839929e-03
    CY001_STATU;2009;Dec;11220020GR;'03900;CYZ900;-9,99999999839929e-03
    All the others records with a decimal AMOUNT are loaded correctly.
    So, my problem is that I NEED to load all the records (with the decimal and the scientific notation format) together (without records rejected), but I don't know which datatype I have to use for the AMOUNT field....
    Anybody has any idea ???
    Any help would be appreciated
    Thanks in advance
    Alex

    @OP,
    What version of Oracle are you using?
    Just cut'n'paste of you script and example woked FINE for me.
    however my quation is... An external table will LOAD all data or none at all. How are you validating/concluding that...
    I have some records rejected, and all these records contain the last field AMOUNT with the scientific notation
    select * from v$version where rownum <2;
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    select * from mydata;
    CY001_STATU     2009     Jan     11220020GR     '03900     CYZ900     -9,99999999839929e-03
    CY001_STATU     2009     Feb     11220020GR     '03900     CYZ900     -9,99999999839929e-03
    CY001_STATU     2009     Jan     11220020GR     '03900     CYZ900     -9,99999999839929e-03
    CY001_STATU     2009     Jan     11200100     '60800     CYZ900     41380,77
    CY001_STATU     2009     Mar     11220020GR     '03900     CYZ900     -9,99999999839929e-03
    CY001_STATU     2009     Dec     11220020GR     '03900     CYZ900     -9,99999999839929e-03
    CY001_STATU     2009     Jan     11220020GR     '03900     CYZ900     -9,99999999839929e-03
    CY001_STATU     2009     Jan     11200100     '60800     CYZ900     41380,77MYDATA table script is...
    drop table mydata;
    CREATE TABLE mydata
    COUNTRY VARCHAR2(50 BYTE),
    YEAR VARCHAR2(20 BYTE),
    PERIOD VARCHAR2(20 BYTE),
    ACCOUNT VARCHAR2(50 BYTE),
    DEPT VARCHAR2(20 BYTE),
    ACTIVITY_LOC VARCHAR2(20 BYTE),
    AMOUNT VARCHAR2(50 BYTE)
    ORGANIZATION EXTERNAL
    ( TYPE ORACLE_LOADER
    DEFAULT DIRECTORY IN_DIR
    ACCESS PARAMETERS
    ( RECORDS DELIMITED BY NEWLINE
    BADFILE 'IN_DIR':'HYP_LOAD.bad'
    DISCARDFILE 'IN_DIR':'HYP_LOAD.dsc'
    LOGFILE 'IN_DIR':'HYP_LOAD.log'
    SKIP 0
    FIELDS TERMINATED BY ";"
    MISSING FIELD VALUES ARE NULL
    REJECT ROWS WITH ALL NULL FIELDS
    "COUNTRY" Char,
    "YEAR" Char,
    "PERIOD" Char,
    "ACCOUNT" Char,
    "DEPT" Char,
    "ACTIVITY_LOC" Char,
    "AMOUNT" Char
    LOCATION (IN_DIR:'total.txt')
    REJECT LIMIT UNLIMITED
    NOPARALLEL
    NOMONITORING;vr,
    Sudhakar B.

  • Saving result from sp_executesql into a variable and using dynamic column name - getting error "Error converting data type varchar to numeric"

    Im getting an error when running a procedure that includes this code.
    I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql
    DECLARE @retval AS DECIMAL(12,2)
    DECLARE @MonthVal VARCHAR(20), @SpreadKeyVal INT
    DECLARE @sqlcmd AS NVARCHAR(150)
    DECLARE @paramdef NVARCHAR(150)
    SET @MonthVal = 'Month' + CAST(@MonthNumber AS VARCHAR(2) );
    SET @SpreadKeyVal = @SpreadKey; --CAST(@SpreadKey AS VARCHAR(10) );
    SET @sqlcmd = N' SELECT @retvalout = @MonthVal FROM dbo.CourseSpread WHERE CourseSpreadId = @SpreadKeyVal';
    SET @paramdef = N'@MonthVal VARCHAR(20), @SpreadKeyVal INT, @retvalout DECIMAL(12,2) OUTPUT'
    --default
    SET @retval = 0.0;
    EXECUTE sys.sp_executesql @sqlcmd,@paramdef, @MonthVal = 'Month4',@SpreadKeyVal = 1, @retvalout = @retval OUTPUT;
    SELECT @retval
    DECLARE @return_value DECIMAL(12,2)
    EXEC @return_value = [dbo].[GetSpreadValueByMonthNumber]
    @SpreadKey = 1,
    @MonthNumber = 4
    SELECT 'Return Value' = @return_value
    Msg 8114, Level 16, State 5, Line 1
    Error converting data type varchar to numeric.

    Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
    to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for: 
    https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
    >> I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql <<
    This is so very, very wrong! A column is an attribute of an entity. The idea that you are so screwed up that you have no idea if you want
    the shoe size, the phone number or something else at run time of this entity. 
    In Software Engineering we have a principle called cohesion that says a model should do one and only one task, have one and only one entry point, and one and only one exit point. 
    Hey, on a scale from 1 to 10, what color is your favorite letter of the alphabet? Yes, your mindset is that level of sillyity and absurdity. 
    Do you know that SQL is a declarative language? This family of languages does not use local variables! 
    Now think about “month_val” and what it means. A month is a temporal unit of measurement, so this is as silly as saying “liter_val” in your code. Why did you use “sp_” on a procedure? It has special meaning in T-SQL.  
    Think about how silly this is: 
     SET @month_val = 'Month' + CAST(@month_nbr AS VARCHAR(2));
    We do not do display formatting in a query. This is a violation of at the tiered architecture principle. We have a presentation layer. But more than that, the INTERVAL temporal data type is a {year-month} and never just a month. This is fundamental. 
    We need to see the DDL so we can re-write this mess. Want to fix it or not?
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How to load decimal values into a file using bcp in SQL Server 2000?

    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.

    You can modify the decimal column(s) in the table to varchar type before export. But it does not look good.
    alter table [dbo].[Product_Sales]
    Alter column [Product_Amount] varchar(20)
    alter table [dbo].[Product_Sales]
    Alter column [Category_Amount] varchar(20)
    Does that make any sense?
    Known is a DROP, Unknown is an OCEAN.
    Basically you modify the decimal column to a varchar type before you run the bcp command for export. You can modify your source table or you can modify them on the fly. It is just a workaround.
    Modifying the source wouldn't be a good idea. Never do that if you can't get your desired output.
    Known is a DROP, Unknown is an OCEAN.

  • Static Decimal value in insert query

    HI am going to insert decimal value in table but i got this error" Arithmetic overflow error converting numeric to data type numeric."
    HERE  val one is a decimal value how can do this?
    INSERT INTO TBL(CON,VAL)
    SELECT ID,'2.0' FROM TBL1

    Chino,
    SHud eb a problem with the precision value of your column. Try increasing the same. The following example shud help:
    --case 1
    declare @tab table (id decimal(3,2),name varchar(100))
    --precision=1 scale=2
    insert @tab select 51.987 , 'jk'
    select * from @tab
    Msg 8115, Level 16, State 8, Line 2
    Arithmetic overflow error converting numeric to data type numeric.
    --case 2
    declare @tab table (id decimal(4,2),name varchar(100))
    --precision=2 scale=2
    insert @tab select 51.987 , 'jk'
    select * from @tab
    Works Fine
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • Error with decimal value using DG4MSQL

    Hello,
    when i make an update on a numeric column [numeric(38,15)] of a database table residing on a MS-SQL-Server 2005 it works fine when the value has no decimal part:
    declare
    v_test1 number := 1;
    begin
      update CUSTOMER@DBL_MSSQL4 set "freenumber1" = v_test1;
    commit;
    end;
    /But if i use a value with a decimal part it gets an error
    declare
    v_test1 number := 1.2;
    begin
      update CUSTOMER@DBL_MSSQL4 set "freenumber1" = v_test1;
    commit;
    end;
    /Error message:
    ORA-28500: Verbindung von ORACLE zu Fremdsystem gab diese Nachricht zurück:
    [Oracle][ODBC SQL Server Driver]Ungültiger Zeichenwert für  Konvertierungsangabe
    ORA-02063: vorherige 2 lines von DBL_MSSQL4
    ORA-06512: in Zeile 7And here is the trace:
    Oracle Corporation --- MONTAG     MRZ 08 2010 15:20:14.940
    Heterogeneous Agent Release
    11.1.0.6.0
    Oracle Corporation --- MONTAG     MRZ 08 2010 15:20:14.940
        Version 11.1.0.6.0
    Entered hgogprd
    HOSGIP for "HS_FDS_TRACE_LEVEL" returned "DEBUG"
    Entered hgosdip
    setting HS_OPEN_CURSORS to default of 50
    HOSGIP returned value of "RECOVER" for HS_FDS_RECOVERY_ACCOUNT
    HOSGIP returned a value for HS_FDS_RECOVERY_PWD
    setting HS_FDS_TRANSACTION_LOG to default of "HS_TRANSACTION_LOG"
    setting HS_FDS_TRANSACTION_ISOLATION to default of "READ_COMMITTED"
    setting HS_NLS_NCHAR to default of "AL16UTF16"
    setting HS_FDS_TIMESTAMP_AS_DATE to default of "TRUE"
    setting HS_RPC_FETCH_REBLOCKING to default of "ON"
    setting HS_FDS_FETCH_ROWS to default of "100"
    setting HS_FDS_RESULTSET_SUPPORT to default of "FALSE"
    setting HS_FDS_PROC_IS_FUNC to default of "FALSE"
    setting HS_FDS_CHARACTER_SEMANTICS to default of "FALSE"
    setting HS_FDS_MAP_NCHAR to default of "TRUE"
    setting HS_NLS_DATE_FORMAT to default of "YYYY-MM-DD HH24:MI:SS"
    setting HS_FDS_REPORT_REAL_AS_DOUBLE to default of "FALSE"
    setting HS_LONG_PIECE_TRANSFER_SIZE to default of "65536"
    setting HS_SQL_HANDLE_STMT_REUSE to default of "FALSE"
    setting HS_FDS_QUERY_DRIVER to default of "FALSE"
    setting HS_CALL_NAME_ISP to "gtw$:SQLTables;gtw$:SQLColumns;gtw$:SQLPrimaryKeys;gtw$:SQLForeignKeys;gtw$:SQLProcedures;gtw$:SQLStatistics"
    Exiting hgosdip, rc=0
    ORACLE_SID is "DG4MSQL"
    Product-Info:
      Port Rls/Upd:6/0 PrdStat:0
      Agent:Oracle Database Gateway for MSSQL
      Facility:hsa
      Class:MSSQL, ClassVsn:11.1.0.6.0_0006, Instance:DG4MSQL
    Exiting hgogprd, rc=0
    Entered hgoinit
    HOCXU_COMP_CSET=1
    HOCXU_DRV_CSET=178
    HOCXU_DRV_NCHAR=2000
    HOCXU_DB_CSET=178
    HOCXU_SEM_VER=102000
    Entered hgolofn at 2010/03/08-15:20:14
    RC=-1 from HOSGIP for "PATH"
    PATH from environment is "D:\oracle\product\10.2.0\db_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\IBM\Informix\Client-SDK\bin;C:\Programme\Microsoft SQL Server\90\Tools\binn\;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\WINDOWS\system32\WindowsPowerShell\v1.0"
    Exiting hgolofn, rc=0 at 2010/03/08-15:20:14
    HOSGIP for "HS_OPEN_CURSORS" returned "50"
    HOSGIP for "HS_FDS_FETCH_ROWS" returned "100"
    HOSGIP for "HS_LONG_PIECE_TRANSFER_SIZE" returned "65536"
    HOSGIP for "HS_NLS_NUMERIC_CHARACTER" returned ".,"
    Exiting hgoinit, rc=0 at 2010/03/08-15:20:14
    Entered hgolgon at 2010/03/08-15:20:14
    reco:0, name:testuju, tflag:0
    Entered hgosuec at 2010/03/08-15:20:14
    uencoding=UTF16
    Entered shgosuec at 2010/03/08-15:20:14
    Exiting shgosuec, rc=0 at 2010/03/08-15:20:14
    shgosuec() returned rc=0
    Exiting hgosuec, rc=0 at 2010/03/08-15:20:14
    HOSGIP for "HS_FDS_RECOVERY_ACCOUNT" returned "RECOVER"
    HOSGIP for "HS_FDS_TRANSACTION_LOG" returned ""HS_TRANSACTION_LOG""
    HOSGIP for "HS_FDS_TIMESTAMP_AS_DATE" returned "TRUE"
    HOSGIP for "HS_FDS_CHARACTER_SEMANTICS" returned "FALSE"
    HOSGIP for "HS_FDS_MAP_NCHAR" returned "TRUE"
    HOSGIP for "HS_FDS_RESULT_SET_SUPPORT" returned "FALSE"
    HOSGIP for "HS_FDS_PROC_IS_FUNC" returned "FALSE"
    HOSGIP for "HS_FDS_REPORT_REAL_AS_DOUBLE" returned "FALSE"
    using testuju as default value for "HS_FDS_DEFAULT_OWNER"
    HOSGIP for "HS_SQL_HANDLE_STMT_REUSE" returned "FALSE"
    Entered hgocont at 2010/03/08-15:20:14
    HS_FDS_CONNECT_INFO = "OBELIXUS//testuju"
    RC=-1 from HOSGIP for "HS_FDS_CONNECT_STRING"
    Entered hgogenconstr at 2010/03/08-15:20:14
    dsn:OBELIXUS//testuju, name:testuju
    optn:
    Entered shgogohn at 2010/03/08-15:20:14
    ohn is 'OraGtw11g_home1'
    Exiting shgogohn, rc=0 at 2010/03/08-15:20:14
    Entered hgocont_OracleCsidToIANA at 2010/03/08-15:20:14
    Returning 2252
    Exiting hgocont_OracleCsidToIANA at 2010/03/08-15:20:15
    ##>Connect Parameters (len=211)<##
    ## DRIVER=Oracle 11g dg4msql-OraGtw11g_home1;
    ## SERVER=OBELIXUS;
    ## Database=testuju;
    #! UID=testuju;
    #! PWD=*
    ## AnsiNPW=Yes;
    ## QuotedId=Yes;
    ## IANAAppCodePage=2252;
    ## ArraySize=100;
    ## PadVarbinary=0;
    ## SupportNumericPrecisionGreaterThan38=1;
    Exiting hgogenconstr, rc=0 at 2010/03/08-15:20:15
    DriverName:HGmsss22.dll, DriverVer:05.20.0053 (b0041, u0024)
    DBMS Name:Microsoft SQL Server, DBMS Version:09.00.3068
    Exiting hgocont, rc=0 at 2010/03/08-15:20:15
    SQLGetInfo returns Y for SQL_CATALOG_NAME
    SQLGetInfo returns 128 for SQL_MAX_CATALOG_NAME_LEN
    Exiting hgolgon, rc=0 at 2010/03/08-15:20:15
    Entered hgoulcp at 2010/03/08-15:20:15
    Entered hgowlst at 2010/03/08-15:20:15
    Exiting hgowlst, rc=1 at 2010/03/08-15:20:15
    SQLGetInfo returns Y for SQL_PROCEDURES
    Exiting hgoulcp, rc=0 at 2010/03/08-15:20:15
    Entered hgouldt at 2010/03/08-15:20:15
    Exiting hgouldt, rc=0 at 2010/03/08-15:20:15
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber1
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber2
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber3
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber4
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber5
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber6
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber7
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber8
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber9
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber10
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber11
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber12
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber13
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber14
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber15
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber16
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber17
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber18
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber19
      3 DECIMAL       Y         41         41  38/ 15    0   0   0 freenumber20
    91 DATE          Y         16         16   0/  0    0   0   0 freedate1
    91 DATE          Y         16         16   0/  0    0   0   0 freedate2
    91 DATE          Y         16         16   0/  0    0   0   0 freedate3
    91 DATE          Y         16         16   0/  0    0   0   0 freedate4
    91 DATE          Y         16         16   0/  0    0   0   0 freedate5
    91 DATE          Y         16         16   0/  0    0   0   0 freedate6
    91 DATE          Y         16         16   0/  0    0   0   0 freedate7
    91 DATE          Y         16         16   0/  0    0   0   0 freedate8
    91 DATE          Y         16         16   0/  0    0   0   0 freedate9
    91 DATE          Y         16         16   0/  0    0   0   0 freedate10
    91 DATE          Y         16         16   0/  0    0   0   0 freedate11
    91 DATE          Y         16         16   0/  0    0   0   0 freedate12
    91 DATE          Y         16         16   0/  0    0   0   0 freedate13
    91 DATE          Y         16         16   0/  0    0   0   0 freedate14
    91 DATE          Y         16         16   0/  0    0   0   0 freedate15
    91 DATE          Y         16         16   0/  0    0   0   0 freedate16
    91 DATE          Y         16         16   0/  0    0   0   0 freedate17
    91 DATE          Y         16         16   0/  0    0   0   0 freedate18
    91 DATE          Y         16         16   0/  0    0   0   0 freedate19
    91 DATE          Y         16         16   0/  0    0   0   0 freedate20
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean1
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean2
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean3
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean4
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean5
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean6
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean7
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean8
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean9
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean10
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean11
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean12
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean13
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean14
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean15
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean16
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean17
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean18
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean19
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean20
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean21
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean22
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean23
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean24
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean25
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean26
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean27
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean28
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean29
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean30
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean31
      3 DECIMAL       Y          3          3   1/  0    0   0   0 freeboolean32
    12 VARCHAR       Y         50         50   0/  0    0   0   0 custtypekey
    -4 LONGVARBINARY Y          0          0   0/  0    0   0  20 logo
      3 DECIMAL       Y          3          3   1/  0    0   0   0 Active
    91 DATE          N         16         16   0/  0    0   0   0 CreateDate
    12 VARCHAR       Y         50         50   0/  0    0   0   0 CreateUser
    91 DATE          N         16         16   0/  0    0   0   0 UpdateDate
    12 VARCHAR       Y         50         50   0/  0    0   0   0 UpdateUser
    12 VARCHAR       Y         50         50   0/  0    0   0   0 Status
    12 VARCHAR       Y         50         50   0/  0    0   0   0 WFInstanceId
    12 VARCHAR       Y         50         50   0/  0    0   0   0 RightPk
      3 DECIMAL       Y         12         12  10/  0    0   0   0 ClientNo
      3 DECIMAL       Y          3          3   1/  0    0   0   0 MassData
      3 DECIMAL       Y          3          3   1/  0    0   0   0 OfflineData
    12 VARCHAR       Y         50         50   0/  0    0   0   0 PersonPk
    Exiting hgodscr, rc=0 at 2010/03/08-15:20:16
    Entered hgotcis at 2010/03/08-15:20:16
    Calling SQLStatistics for CUSTOMER
    Calling SQLColumns for testuju.CUSTOMER
    Exiting hgotcis, rc=0 at 2010/03/08-15:20:16
    Entered hgoclse, cursor id 1 at 2010/03/08-15:20:16
    Exiting hgoclse, rc=0 at 2010/03/08-15:20:16
    Entered hgodafr, cursor id 1 at 2010/03/08-15:20:16
    Exiting hgodafr, rc=0 at 2010/03/08-15:20:16
    Entered hgopars, cursor id 1 at 2010/03/08-15:20:16
    type:0
    SQL text from hgopars, id=1, len=39 ...
         00: 41445055 22204554 54535543 52454D4F  [UPDATE "CUSTOMER]
         10: 45532022 66222054 6E656572 65626D75  [" SET "freenumbe]
         20: 20223172 3D203F                      [r1" = ?]
    Exiting hgopars, rc=0 at 2010/03/08-15:20:16
    Entered hgoexec, cursor id 1 at 2010/03/08-15:20:16
    octype=2
    hgoexec, line 91: Printing hoada @ 02175BCC
    MAX:1, ACTUAL:1, BRC:1, WHT=3
    DTY         NULL-OK  LEN  MAXBUFLEN   PR/SC  CST IND MOD NAME
      3 DECIMAL N         65          0   0/  0    0   0   0 ?
    Entered hgoprbv at 2010/03/08-15:20:16
    hgoprbv, line 119: Printing hoada @ 02175BCC
    MAX:1, ACTUAL:1, BRC:1, WHT=3
    DTY         NULL-OK  LEN  MAXBUFLEN   PR/SC  CST IND MOD NAME
      3 DECIMAL N         65          0   0/  0    0   0   0 ?
    Exiting hgoprbv, rc=0 at 2010/03/08-15:20:16
    Entered hgopoer at 2010/03/08-15:20:16
    hgopoer, line 159: got native error 0 and sqlstate 22018; message follows...
    [Oracle][ODBC SQL Server Driver]Ungültiger Zeichenwert für  Konvertierungsangabe
    Exiting hgopoer, rc=0 at 2010/03/08-15:20:16
    hgoexec, line 216: calling SQLExecute got sqlstate 22018
    nrows:0
    Exiting hgoexec, rc=28500 at 2010/03/08-15:20:16 with error ptr FILE:hgoexec.c LINE:216 ID:Executing SQL stmt
    Entered hgocomm at 2010/03/08-15:24:22
    keepinfo:0, tflag:1
       00: 44555248 45522E42 53455247 44522E53  [HRUDB.REGRESS.RD]
       10: 2E534D42 2E564544 4F2E5355 4C434152  [BMS.DEV.US.ORACL]
       20: 4F432E45 65312E4D 33366465 322E6631  [E.COM.1eed631f.2]
       30: 2E34332E 38363832 31                 [.34.28681]
                     tbid (len 10) is ...
       0: 00220002 00007009 0104               [.."..p....]
    cmt(0):
    Entered hgocpctx at 2010/03/08-15:24:22
    Exiting hgocpctx, rc=0 at 2010/03/08-15:24:22
    Exiting hgocomm, rc=0 at 2010/03/08-15:24:22
    Entered hgolgof at 2010/03/08-15:24:22
    tflag:1
    Exiting hgolgof, rc=0 at 2010/03/08-15:24:22
    Entered hgoexit at 2010/03/08-15:24:22
    Exiting hgoexit, rc=0 at 2010/03/08-15:24:22The init file for the DG4MSQL look like this:
    HS_FDS_CONNECT_INFO=OBELIXUS//testuju
    HS_FDS_TRACE_LEVEL=DEBUG
    HS_FDS_RECOVERY_ACCOUNT=RECOVER
    HS_FDS_RECOVERY_PWD=RECOVERAny ideas what i have to change to be able to update numeric columns with values containing a deciomal part using DG4MSQL?
    Many thanks in advance for any help.
    Regards Hartmut

    Hello Mike,
    here the results of the given select statements:
    select * from NLS_DATABASE_PARAMETERS;
    NLS_LANGUAGE          AMERICAN
    NLS_NCHAR_CHARACTERSET     AL16UTF16
    NLS_TERRITORY          AMERICA
    NLS_CURRENCY          $
    NLS_ISO_CURRENCY     AMERICA
    NLS_NUMERIC_CHARACTERS     .,
    NLS_CHARACTERSET     WE8MSWIN1252
    NLS_CALENDAR          GREGORIAN
    NLS_DATE_FORMAT          DD-MON-RR
    NLS_DATE_LANGUAGE     AMERICAN
    NLS_SORT          BINARY
    NLS_TIME_FORMAT          HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT     DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT     HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT     DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY     $
    NLS_COMP          BINARY
    NLS_LENGTH_SEMANTICS     BYTE
    NLS_NCHAR_CONV_EXCP     FALSE
    NLS_RDBMS_VERSION     10.2.0.4.0select * from NLS_INSTANCE_PARAMETERS ;
    NLS_LANGUAGE          GERMAN
    NLS_TERRITORY          GERMANY
    NLS_SORT     
    NLS_DATE_LANGUAGE     
    NLS_DATE_FORMAT     
    NLS_CURRENCY     
    NLS_NUMERIC_CHARACTERS     
    NLS_ISO_CURRENCY     
    NLS_CALENDAR     
    NLS_TIME_FORMAT     
    NLS_TIMESTAMP_FORMAT     
    NLS_TIME_TZ_FORMAT     
    NLS_TIMESTAMP_TZ_FORMAT     
    NLS_DUAL_CURRENCY     
    NLS_COMP     
    NLS_LENGTH_SEMANTICS     BYTE
    NLS_NCHAR_CONV_EXCP     FALSEselect * from NLS_SESSION_PARAMETERS ;
    NLS_LANGUAGE          GERMAN
    NLS_TERRITORY          GERMANY
    NLS_CURRENCY          €
    NLS_ISO_CURRENCY     GERMANY
    NLS_NUMERIC_CHARACTERS     ,.
    NLS_CALENDAR          GREGORIAN
    NLS_DATE_FORMAT          MM/DD/YYYY HH24:MI:SS
    NLS_DATE_LANGUAGE     GERMAN
    NLS_SORT          GERMAN
    NLS_TIME_FORMAT          HH24:MI:SSXFF
    NLS_TIMESTAMP_FORMAT     DD.MM.RR HH24:MI:SSXFF
    NLS_TIME_TZ_FORMAT     HH24:MI:SSXFF TZR
    NLS_TIMESTAMP_TZ_FORMAT     DD.MM.RR HH24:MI:SSXFF TZR
    NLS_DUAL_CURRENCY     €
    NLS_COMP          BINARY
    NLS_LENGTH_SEMANTICS     BYTE
    NLS_NCHAR_CONV_EXCP     FALSEThat was easy, but how and where to read the settings of the MS-SQL-Server?
    All i can find is
    Sprache               Deutsch (Deutschland)
    Standardsprache          EnglischI have defined one more parameter in the ini<...>.ora file:
    HS_LANGUAGE=AMERICAN_AMERICA.WE8MSWIN1252and now it works!
    (With "HS_LANGUAGE=GERMAN_GERMANY.WE8MSWIN1252" is gives the same old error.)
    Many thanks for your help!
    Reagrds Hartmut

  • Query to display integer and decimal and integer in the same column

    Hello , 
    Have a question, 
    is there a easier way to do this.. is the question
    i have a column called units.. and i need to display either a integer in it if the value does not have any value after the decimal point .. so it shud be display as integer. But if it is a float then only display it with decimal values
    like 
    Units
    100
    .123
    1000.55
    2000

    Check this out although formatting needs to be done in the client application:
    DECLARE @t TABLE (units FLOAT)
    INSERT INTO @t (units)
    VALUES (100)
    ,(.123)
    ,(1000.55)
    ,(2000)
    SELECT units
    ,convert(VARCHAR(30), units) AS DisplayOnly
    FROM @t
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

Maybe you are looking for

  • Camera raw update to Lightroom 3.6

    I need to install version 7.1 of camera raw so I can use lightroon 3.6. How do I do this?

  • DVI-D-to-VGA vs. Straight DVI-D Cable?

    Hi. Apologies if I missed this question elsewhere. I'm using the included DVI-D-to-VGA converter to connect to an LG monitor. Next I want to share this monitor with a second, similar Mac (PowerBook), so I'll be getting a KVM switch. My monitor suppor

  • Adapter 6525 black ink cartridge

    I have an HP 6525 printer.  I purchased a pack of new ink cartridges and all fit fine except the black.  The setup black ink cartridge is about twice the width of the one that came with the pack.  Is there an adapter for the smaller cartridges?  If s

  • Regarding quantity field...value in layout

    Hi All, my issue is here i am passing vbrp-fkimg value to layout.. the value in the field above is 100.000, but here in the layout it is coming as 100 and printing it. how the value of 100.000 become 100. any settings, configuaration are there which

  • Sync group does not show local instance

    I cannot find my local sql server listed when I add a new sync group. The hub dialog is ok, but the reference database does not show databases registered using the Data Sync Agent. Those local databases are SQL 2008 SQLExpress, 2012 SQLExpress and 20