Any expert in SQL Server - Sajha Mobile
SAJHA MOBILE
Any expert in SQL Server
Posts 3 · Viewed 4310 · Go to Last Post
Mukurdhom
· Snapshot 0
Like · Likedby · 0

Hello Gurus

I am banging my head from this morning. Did some google search. Found some example, but not helping me a lot.
Here is the problem

Given string : '152527_OR100006_UHNJ3241159000_1_.pdf'
My task: Parse the string into different column. 
FileID: 152527
SalesOrderNum: OR10006
ItemNumber: UHNJ3241159000
EdiLine: 1
FileType: .pdf

If the size of string was fixed, then it was not a big deal. Size of string is dynamic and "_" underscore is suppose to act as a delimiter. 

Thank you
marulez
· Snapshot 12
Like · Liked by · 0
As long as you have delimeter you should be good to go.
My recommendation is to create a function or stored procedure which splits the string depending upon the delimeter and return the result in table.

Here is a solution which might help you: http://www.codeproject.com/KB/database/SQL_UDF_to_Parse_a_String.aspx

Also in stackoverflow:  http://stackoverflow.com/questions/2647/split-string-in-sql
Mukurdhom
· Snapshot 32
Like · Liked by · 0

Thank you Marulez... 
Please log in to reply to this post

You can also log in using your Facebook
View in Desktop
What people are reading
You might like these other discussions...
· Posts 77 · Viewed 18418 · Likes 16
· Posts 1 · Viewed 98
· Posts 1 · Viewed 102
· Posts 1 · Viewed 261
· Posts 16 · Viewed 3516 · Likes 3
· Posts 1 · Viewed 216
· Posts 1 · Viewed 335
· Posts 6 · Viewed 921 · Likes 1
· Posts 1 · Viewed 172
· Posts 1 · Viewed 183



Your Banner Here
Travel Partners
Travel House Nepal