DB Field format is LName, FName (Single field 'NAME') - need report to read FName, LName - is there a command for that?

Posted on 2008-11-19
Last Modified: 2012-05-05
I have a report that needs to pull a contact name in the format of FirstName, LastName - the field in the DB is a single field 'NAME' formatted in LastName, FirstName - is there a way to flip the test on each side of the comma and achieve this? All assistance is appreciated.
Question by:it_stops
    LVL 9

    Assisted Solution

    I assume you want the sql :
    declare @str1 varchar(50)
    declare @str2 varchar(50)
    set @str1 = 'FirstName, LastName'
    set @str2 = ''
    select right (@str1, len(@str1) - charindex(',',@str1)) +', '+LEFT ( @str1 , charindex(',',@str1)-1 ) as NewName

    Open in new window

    LVL 1

    Accepted Solution

    Thanks Very Much! Will try it and post results.
    LVL 1

    Author Comment

    this was a great answer

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Hello, In my precious Article  ( saw the Configuration part for Microstrategy which included Metadata Creation and DataSource Preparation as …
    Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now