Forum Replies Created

Viewing 7 posts - 1 through 7 (of 7 total)

  • RE: How to remove leading zeros?

    There can be zeros in the middle of the number. I just didnt give it as an example.

    Thanks.

  • RE: How to remove leading zeros?

    I think DavidT got it...

    LEFT JOIN DataPaqMFG ON convert(varchar(15),(replicate('0', (15 - len(DataPaqMFG.TD_PART))))) + cast(DataPaqMFG.TD_PART as varchar(15)) = convert(varchar(15),(replicate('0', (15 - len(products.PART_NUM))))) + cast(products.PART_NUM as varchar(15))

    Can anyone find a reason...

  • RE: How to remove leading zeros?

    quote:


    No, the PATINDEX finds the beginning of 'ed' in the column--meaning, the index of the 'e'.

    The -1 is just to subtract...

  • RE: How to remove leading zeros?

    Both fields in both tables have the same type and length. nvarchar 15

    Can I add a dynamic amount of zeros? For instance... If the string is 123 can I add...

  • RE: How to remove leading zeros?

    Frehan,

    Good point. I will look at your solution to add zeros to the column without them!

    Sam,

    If ED isnt found then I am trying to do a LEFT with a -1.

    ...

  • RE: How to remove leading zeros?

    Jeremy,

    Good call! It works!

    Here is the statement:

    LEFT JOIN DataPaqMFG ON RTRIM(DataPaqMFG.TD_PART) = RIGHT(RTRIM(products.PART_NUM), LEN(RTRIM(DataPaqMFG.TD_PART)))

    Thanks All!

  • RE: How to remove leading zeros?

    The fields will have the same value...

    12345 -- 12345

    00123 -- 123

    01234 -- 1234

    01ed3 -- 1ed3

    The only cases that have letters are "ed". It is roughly 200...

Viewing 7 posts - 1 through 7 (of 7 total)