Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    6

    Unanswered: strip text from a string

    I'm trying to find a way to strip text from a string. In the past (pre SQL Server) I would've used

    LName: Left(NCBH!Name,InStr(1,NCBH!NAME,",",1)-1)

    To strip the last name from a string like

    Franks,George J

    Apparently InStr is not a recognized function in SQL Server 2000. Or is it available but not in a view?

    Any thoughts would be greatly appreciated.

  2. #2
    Join Date
    Dec 2002
    Posts
    1,245

    Re: strip text from a string

    How about:

    Code:
    declare @name varchar(30)
    
    select @name = 'Franks,George J'
    
    select left(@name, (charindex(',', @name) - 1))
    Regards,

    hmscott

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

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