Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: Lastname, Firstname switch

Results 1 to 4 of 4
Share This Thread →
  1. #1
    james.martin is offline Registered User
    Join Date
    Sep 2012
    Posts
    1
    Rep Power
    0

    Lastname, Firstname switch

    Hi,

    Please help, im not at all good with SQL but I have created the query below. It pulls information from a room booking system to display on a digital signage product.

    At present the 'Name' field outputs as lastname, firstname. I really need it to display as Firstname Lastname but still under the one column.

    Can someone take a look please? It would be greatly appreciated.

    SELECT HOST9006.DESCRIPTION, HOST0110.ROOMNAME, HOST0140.NAME, dateadd(mi, HOST0120.STARTMINS, HOST0120.MTGDATE) AS ASTART,

    dateadd(mi, HOST0120.ENDMINS, HOST0120.MTGDATE) AS AFINISH, CONVERT (VARCHAR(5), dateadd(mi, HOST0120.STARTMINS,

    HOST0120.MTGDATE) ,108) AS START, CONVERT (VARCHAR(5), dateadd(mi, HOST0120.ENDMINS, HOST0120.MTGDATE) ,108) AS FINISH,

    HOST0120.MTGKEY, HOST0120.HIPTYPE, HOST0120.ROOMKEY

    FROM HOST0140
    INNER JOIN HOST0120
    ON HOST0120.OWNERKEY=HOST0140.PERSONKEY
    INNER JOIN HOST9006
    ON HOST9006.KEYVALUE=HOST0120.MTGSTATE
    INNER JOIN HOST0110
    ON HOST0110.ROOMKEY=HOST0120.ROOMKEY

    WHERE CANCELSTATE='0'

    AND MTGDATE >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)
    AND MTGDATE < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1)
    AND MTGSTATE <> '11'
    ORDER BY START

    Thanks

  2. #2
    bigmike1212's Avatar
    bigmike1212 is offline 0x800A0C93
    Join Date
    Jan 2009
    Location
    Ridin' through this world...
    Posts
    2,975
    Rep Power
    1310
    How is HOST0140.NAME stored?

    Does it look like:
    smith, john
    ?

    Is host0140 a table or a query?
    Brinkster- free development account. Not affiliated, but I sure like free. Brinkster.com

  3. #3
    gk53's Avatar
    gk53 is offline Contributing User
    Join Date
    Mar 2005
    Location
    Columbus, OH
    Posts
    1,538
    Rep Power
    278
    is any rule in name column? like first name "," last name or space and what about middle name?
    If it is a rules you can do just string manipulation...
    GK
    __________________________________________________ _____
    if you found this post is useful click Give Rep button (bottom side on this reply ) and agree

  4. #4
    jadekq5 is offline Registered User
    Join Date
    Mar 2010
    Location
    United States
    Posts
    11
    Rep Power
    0

    hey everyone

    just dropping by to say hi

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

Similar Threads

  1. Challenging To Write A Query For This Case
    By AASHAA in forum SQL Development
    Replies: 1
    Last Post: April 2nd, 2006, 10:13 AM
  2. Transcation Log
    By axisz in forum Microsoft SQL Server
    Replies: 1
    Last Post: January 25th, 2006, 03:15 AM
  3. Maxxan Rolls Out Intelligent Switch for the Midmarket (Ziff Davis)
    By RSS_News_User in forum Technology News
    Replies: 0
    Last Post: April 30th, 2005, 12:01 PM
  4. FirstName LastName Trim Problem
    By craigl in forum ASP Development
    Replies: 5
    Last Post: June 8th, 2004, 01:31 AM
  5. Insert into and update in ASP
    By bijou in forum ASP Development
    Replies: 1
    Last Post: February 6th, 2004, 08:41 PM

ASP Free Advertisers and Affiliates