How to change a number field into a text?

  • In a given set of commands, take a field for example, how would you change that field that appears as number format to be change into a text format? Thanks!!!

  • Have a look to BOL for CONVERT/CAST

    Way too less information for any other answer.

  • Hope this example helps as you have asked a general question and not given any other information :

    begin

    declare @num int

    set @num = 22

    select cast( @num as char)

    end

    Abhay Chaudhary
    Sr.DBA (MCITP/MCTS :SQL Server 2005/2008 ,OCP 9i)

  • hi_abhay78 (6/25/2009)


    select cast(@num as char)

    Heh. Well unless you specifically need that integer as a fixed-length char(30)...

    CONVERT(varchar(11), @num)

    Paul

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

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