| Author |
Topic |
|
godspeedba
Yak Posting Veteran
90 Posts |
Posted - 2010-02-10 : 06:49:15
|
Does anyone know of a substring capability in SQLI have a field with the below examplesHull(North)Newport(Hants)The only thing I would like returned isHullNewportAny ideas |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2010-02-10 : 06:53:39
|
| select substring(col, 1, charindex('(', col) -1) from tblHarsh Athalyehttp://www.letsgeek.net/ |
 |
|
|
godspeedba
Yak Posting Veteran
90 Posts |
Posted - 2010-02-10 : 06:56:15
|
| I get incorrect syntax with substring :( |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-02-10 : 06:56:31
|
select left(your_column,charindex('(',your_column)-1) No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
msuneerbabu
Starting Member
6 Posts |
Posted - 2010-02-10 : 06:57:10
|
| SUBSTRING ( expression , start , length ) EX:SELECT LastName, SUBSTRING(FirstName, 1, 1) AS Initialif you dont knw abt the start/length of the string, use 'Replace' like "SELECT REPLACE(Column_Value,'(%)',''); |
 |
|
|
godspeedba
Yak Posting Veteran
90 Posts |
Posted - 2010-02-10 : 06:57:53
|
| Hold on, typing error, It works Harsh Athalye you are a genius, thank you very much. |
 |
|
|
godspeedba
Yak Posting Veteran
90 Posts |
Posted - 2010-02-10 : 06:58:27
|
| thank you all for your help.SQL TEAM forum is the best! |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-02-10 : 06:58:36
|
quote: Originally posted by godspeedba I get incorrect syntax with substring :(
Post the statement that errors please. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-02-10 : 06:59:07
|
Ooh - ok No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|