Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
asm
Posting Yak Master
140 Posts |
Posted - 2008-05-29 : 02:47:46
|
| Table has a data like :123,45671234,56712,345612345,678I want to retrive the data before the commalike, 12312341212345thanks |
|
|
saurabh122
Starting Member
16 Posts |
Posted - 2008-05-29 : 03:20:03
|
| select substring(columnName,1,(charindex(',',columnName)-1)) from tableName |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-05-29 : 03:24:18
|
The data, is it stored as varchar or is it a numeric value?1) select left(data, coalesce(nullif(charindex(',', data) - 1, -1), len(data)))2) select floor(data) E 12°55'05.25"N 56°04'39.16" |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-05-29 : 03:25:19
|
| SELECT LEFT(COLUMNNAME,CHARINDEX(',',COLUMNNAME)-1) FROM TABLENAME |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-29 : 03:50:36
|
| SELECT COALESCE(PARSENAME(REPLACE(COLUMNNAME,',','.'),2),PARSENAME(REPLACE(COLUMNNAME,',','.'),1)) FROM TABLENAME |
 |
|
|
|
|
|
|
|