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 |
stausif
Starting Member
5 Posts |
Posted - 2012-07-02 : 08:30:16
|
In my database I have several paths as shown below\Credit\Input\Shared\Docs \logs\logo\docu\docfrom the above string I want to extract the folder name between the initial two slashes eg : Credit and logsWhat SQl is needed to do that.. Thanks.. |
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2012-07-02 : 08:42:04
|
There's probably a cool way to do this with xml, but declare @str varchar(50) = '\Credit\Input\Shared\Docs \logs\logo\docu\doc'select SUBSTRING(@str,9, LEN(@str)- PATINDEX('%\logs%',@str))JimEveryday I learn something that somebody else already knew |
|
|
stausif
Starting Member
5 Posts |
Posted - 2012-07-02 : 10:28:11
|
Hi, Jim thanks for the reply.. Jim just one request could you post xml method also it will be a great help as I am a new learner.. Once again thanks for sharing the knowledge.. |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2012-07-02 : 13:05:14
|
Unfortunately I don't know if there is an XML way of doing this, I just thought there might be because of the format of the data. I am not terribly familiar with XML.JimEveryday I learn something that somebody else already knew |
|
|
|
|
|