-
How to get the a particular string
Hi,
How can I get the file name in a location?
for eg : In the path E:\apple\New Folder\pics\apple.txt , i need to get the value as just 'apple.txt'
this is just a simple example i have given. But the location is the DB has special characters as well.. such as '::' etc.
Please help me.
-
You store those info in db table? Can use 'select col from table where col like ...' if so.
-
the values stored as the complete path. I just want to take the filename.
If "E:\apple\New Folder\pics\apple.txt" is the value in the DB, I want to get just "apple" from it.
-
Can use substring function to get that.
-
Thats fine. I have tried and I got the results. But, it works for a specific length only. I wanted to get the filenames for differnet paths of different lengths.
Select substring(PATH,charindex('\',PATH)+1,len(PATH))
Result : apple\New Folder\pics\apple.txt
I tried the above one but it returns the values from the first '\' onwards.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|