convert error

convert error

Post by Edwin Ma » Wed, 08 Sep 1999 04:00:00



SET IT.BRANCHCODE = convert(varchar(12),ET.branchcode + ET.DOCNO)
FROM TELEX IT INNER JOIN
    TTELEX ET ON convert(varchar(9),ET.Docno) = SUBSTRING(IT.BRANCHCODE,4,9)

which ET.Docno is a numeric field!

But it shows error convert in varchar to numeric ?!?!?! why?

Edwin

 
 
 

convert error

Post by Torben Pederse » Wed, 08 Sep 1999 04:00:00


Quote:> But it shows error convert in varchar to numeric ?!?!?! why?

Because in -> convert(varchar(12),ET.branchcode + ET.DOCNO) <- the
ET.branchcode + ET.DOCNO is validated before the convert itself and
ET.branchcode is varchar and ET.DOCNO is a numeric.

Booom.

/Torben Pedersen

 
 
 

convert error

Post by Edwin Ma » Wed, 08 Sep 1999 04:00:00


ya .... but what can i do?? I need to convert it first otherwise it will
hint the PK contraint!!

Edwin

 
 
 

convert error

Post by Torben Pederse » Thu, 09 Sep 1999 04:00:00




Quote:> ya .... but what can i do?? I need to convert it first otherwise it will
> hint the PK contraint!!

Just move the ET.branchcode outside the scope - like this:

SET IT.BRANCHCODE = convert(varchar(12), ET.DOCNO) + ET.branchcode

If this does not work then post your definitions for the tables.

/Torben Pedersen

 
 
 

1. CONVERT Error message insufficient space to convert

I am getting the following error message while attempting to create a view.

There is insufficient result space to convert a money value to varchar.

Here is the offending line: CONVERT(varchar(8), ISNULL(Po.nPriceExtended,0.00))
AS EXT

I have an error number from Microsoft KB 8170, however there is no documentation
regarding this error yet.

Thank you in advanced,
Max

2. 7327-GA-Atlanta-C++-Client/Server-Legacy System-Delphi-ORACLE-PowerBuilder-System Architect

3. 22005 Convert error

4. Getting a Date

5. DTS - Cast Convert Error

6. Hooks/Triggers in Oracle.

7. How to trap convert() errors?

8. Unable to connect to Oracle Database

9. Way to convert Error Number to a string

10. How not to exit batch on Convert error?

11. How To Trap convert() Errors?

12. Convert error

13. datetime convert error on RDA