DBAsupport.com Forums - Powered by vBulletin
Results 1 to 8 of 8

Thread: SQL question

Threaded View

  1. #2
    Join Date
    May 2002
    Posts
    2,645
    If you know for sure that you will cutting off everything from the first period on, you select the substring of the output. If you know that "blah" will always be X number of characters long, you can approach it that way.

    select substr(t.target_name, 1, instr(t.target_name,'.',1,1)-1)
    from the rest of your statement....

    The instr starts at position 1, finds the first occurrence of a period, which results in a position value (number), then back that off by one, which then gives the length for the substring.
    Last edited by stecal; 05-06-2011 at 10:31 AM.

Posting Permissions

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


Click Here to Expand Forum to Full Width