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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 cut part of data in the field

Author  Topic 

eugz
Posting Yak Master

210 Posts

Posted - 2011-02-24 : 12:05:40
Hi All

I would like to cut left part data of the field. But unfortunately length of data in this field is not the same. Example data looks like

ASDDH.CFGFG.MMM.GGG
HGFHASD.JKSDFY.MMM.NNN

I need only left part of data. If is possible how it to do?

Thanks.

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-02-24 : 12:08:13
can you specify exactly the Left Part?

Cheers
MIK
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-02-24 : 12:12:36
select left(col,charindex('.',col)-1) from table

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

eugz
Posting Yak Master

210 Posts

Posted - 2011-02-24 : 12:14:15
I mean value before first period from left. The result will looks

ASDDH
HGFHASD

Thanks.
Go to Top of Page

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-02-24 : 12:15:01
use what Madhi suggested

Cheers
MIK
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-02-24 : 12:24:10
or parsename(col,4)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -