SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SQL Server Split text

    Hey,

    I have an issue, i am selecting something in SQL Server which gives me a value of this:

    web_Day_1_Hotel
    web_Day_2_Hotel
    web_Day_3_Windsor (Boxing Day)
    web_Day_4_Henley-on-Thames
    This is an example of the type of query i am using:

    PHP Code:
    SELECT Name as name
    FROM Note 
    FOR XML PATH('item'
    Now what i wanted to know is that if there is a way to display the result as:

    Day 1
    Day 2
    Day 3
    Day 4
    Any ideas?

    Many thanks,
    Software Engineer ASP, ASP.NET, VB, PHP

    Kind regards
    Billy

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,247
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    Code:
    SUBSTRING(REPLACE(name,'_',''),5,5)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats perfect, thanks.

    Has been a long time since i've posted on this forum as i got a new job. But will be posting on here more often.

    Thanks again
    Software Engineer ASP, ASP.NET, VB, PHP

    Kind regards
    Billy


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •