Formatting Output

  • I am recreating an old Access database in SQL Server and need to return the ID field from a table, formatted thus:

    CCR: "CCR" & Format([tblCCR].[CCRID], "00000")

    How can I write an SP that returns the ID in the same format?

    Thanking you in anticipation

    Squirrel

  • Do you want this?

    id

    00001

    00002

    00003

    ?

    If so,

    select right('00000' + convert(varchar,id), 5)

    from ..... etc

    Jeremy

  • This worked a treat -- thanks Jeremy

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

You must be logged in to reply to this topic. Login to reply