Author |
Topic |
tjvinz
Starting Member
5 Posts |
Posted - 2007-03-29 : 15:20:09
|
I have a column of data that I would like to split into 2 columns.The data format is as follows:First 3 characters denote branch locationLast remaining characters denote product IDI would like to make the first 3 characters into a column named branch and the last remaining characters into a table called product_idIs there some kind of split function? The help in transact-sql is not helping me very much. Any insight is appreciated.Thanks! |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-29 : 15:46:50
|
SELECT Col1, LEFT(Col1, 3) AS Branch, SUBSTRING(Col1, 4, 8000) AS Product_IDFROM Table1Peter LarssonHelsingborg, Sweden |
 |
|
Iwanttobeme
Starting Member
4 Posts |
Posted - 2007-03-29 : 15:55:49
|
Wow, that is like SQL 101. I thought this was for difficult issues, good work Peso. Good thing they have intelligent people on here. |
 |
|
tjvinz
Starting Member
5 Posts |
Posted - 2007-03-29 : 16:24:06
|
Peso - Thanks!Iwanttobeme - Thanks for the burn! I really appreciate it. |
 |
|
Iwanttobeme
Starting Member
4 Posts |
Posted - 2007-03-29 : 16:44:24
|
No problem, figured you knew you were messed up. Some people just aren't SQL people, I am willing to bet you charged someone for this as well, I think Pesos should get a cut of your hourly rate. Karma |
 |
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2007-03-29 : 16:50:08
|
I thought this was for difficult issuesIwanttobeme - This is a pretty good question, I guess you haven't seen this thread yet?http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=69568 |
 |
|
Iwanttobeme
Starting Member
4 Posts |
Posted - 2007-03-29 : 16:59:29
|
If a question can be answered in 26 minutes from posting, in one posting I would say two assumptions, one the guy answering it is a genius (Pesos) or two the question is a fairly simple one. Either way, kudos to Pesos for the quick and correct response as well as kudos to tjvinz for making money off of others knowledge. Just pointing out the obvious! Good luck guys! |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-29 : 17:07:22
|
So everything is about the money?Peter LarssonHelsingborg, Sweden |
 |
|
Iwanttobeme
Starting Member
4 Posts |
Posted - 2007-03-29 : 17:25:06
|
Maybe his DBA died, I don't know. Either way I know he benefited from your knowledge. That's all I am saying monetarily or spirtually. |
 |
|
tjvinz
Starting Member
5 Posts |
Posted - 2007-03-29 : 17:26:03
|
OK, not even sure why I am responding, but I want to clear a few things up. I personally do not work with SQL. Our DBA recently passed away and I am picking up the slack. This is not something I want to do really, but the higher-ups thought it would be a good idea to have me do this for some reason. I have learned a lot about SQL so far, but there are some things I need to accomplish where the solution is not obvious to me. Please stop making accusations against me and once again I would like to thank Peso for the help. I figured the solution to this would take an expert probably 2 seconds. Sorry to waste everyone's time. |
 |
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2007-03-30 : 00:28:02
|
tjvinz, don't worry about it, you did absolutely nothing wrong, Iwanttobeme has never posted to these forums before and suddenly popped up and decided to chime in with useless comments. |
 |
|
|