sql query1

  • hi friens i have small doubt in sql server.plese tell me how to solve this issuse.

    table data contains like

    id

    10

    12

    9

    15

    8

    4

    100

    29

    i want output like

    id

    010

    012

    009

    015

    008

    004

    100

    029

    .plese tell me how to write query in sql server

  • This should work, there are other ways as well

    CREATE TABLE #Id

    (

    Id int

    )

    Insert into #Id

    Values (10),(12),(9),(15),(8),(4),(100),(29)

    Select Id,Right('000'+Convert(varchar,Id),3) from #Id

    _________________________________________________________________________
    SSC Guide to Posting and Best Practices

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

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