LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-07-2011, 01:36 PM   #1
ShaqDiesel
Member
 
Registered: Jul 2005
Posts: 144

Rep: Reputation: 15
SQL substring matching a character


I have the following string:
"My dog spot
(page 1)".
I want just "My dog spot". How do I do this in SQL Server? Thanks.

By the way, I don't know how long the string in the parentheses is going to be.
 
Old 04-07-2011, 02:20 PM   #2
ShaqDiesel
Member
 
Registered: Jul 2005
Posts: 144

Original Poster
Rep: Reputation: 15
By the way, the string "My dog spot" may have parentheses too.
 
Old 04-07-2011, 02:53 PM   #3
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,155
Blog Entries: 1

Rep: Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004
Code:
select left(COL, locate('\n', COL) - 1) from tbl;
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl only matching single-character regex patterns? Lordandmaker Programming 3 01-20-2009 08:59 AM
any character matching doesn't yield expected result in PERL gaynut Programming 4 09-26-2008 01:04 AM
Extract substring matching a regular expression tikit Linux - General 2 02-18-2008 01:47 PM
C++ problem extracting a substring - extra character Nylex Programming 4 07-22-2007 11:21 AM
Matching with SQL Ephracis Programming 4 12-16-2004 05:09 AM


All times are GMT -5. The time now is 07:29 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration