Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
I have the following in a column. i would like to seperate them00577|407540288800576|407540288603830|407540259906366|4075402680|855477044906800|407540779400493|4075407672ANYTHING FROM THE LEFT OF | SHOULD BE RETURN IN MY QUERYAS LONG AS THERE ARE NUMBBERS example06366|00576|03830|06800|.00493|I can get the other using right(numbers,11) as 'some number' which will return|8554770449please advise
James K
Master Smack Fu Yak Hacker
3873 Posts
Posted - 2014-07-15 : 11:53:47
You should be able to use LEFT function in a similar way - eg.
LEFT(numbers,CHARINDEX('|',numbers)-1);
If you want to suppress the row that has the blank, use a where clause as in
WHERE LEFT(numbers,CHARINDEX('|',numbers)-1) <> ''