Play with string

  • I've table as follow,

    declare @tDay table

    (

    wDay varchar(7)

    )

    insert into @tDay values('1011100')

    insert into @tDay values('1111000')

    insert into @tDay values('0011101')

    insert into @tDay values('0011000')

    insert into @tDay values('0011101')

    wDay is a 7 character. I dont know, to move 1st character to last character. so that, my result as follows,

    wDay

    -----

    0111001

    1110001

    0111010

    0110000

    0111010

    looking for help

  • (Looks like a test/homework problem to me.)

    Are you familiar with the string functions in T-SQL? Looks to me like you could resolve this with Len, Right, and a simple concat.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • GSquared (1/5/2010)


    (Looks like a test/homework problem to me.)

    Are you familiar with the string functions in T-SQL? Looks to me like you could resolve this with Len, Right, and a simple concat.

    Me tried. But no len as your instructions

    Select (Right(wday,6) + left(wday,1)) as newwDay from @tDay

  • you'd use len as suggested by GSquared if its a variable length value,

    Select RIGHT(wday,LEN(wDay)-1)+ LEFT(wDay,1) FROM @tday

    ---------------------------------------------------------------------------------

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

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