-   Programming (
-   -   SQL substring matching a character (

ShaqDiesel 04-07-2011 01:36 PM

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.

ShaqDiesel 04-07-2011 02:20 PM

By the way, the string "My dog spot" may have parentheses too.

szboardstretcher 04-07-2011 02:53 PM


select left(COL, locate('\n', COL) - 1) from tbl;

All times are GMT -5. The time now is 09:25 PM.