I've dealt with string splits and dilimeters in VB and seems very easy and straight through, but I'm a little bit unsure as to how to do it within a T-SQL script.
I have a column of information on a table. We only have 1 that we can put information into, but currently we put about 4 different bits of info in it, with a '-' delimiter.
I have nfi how to write the script to do this though.
Currently what I have is this via the MSDN
SELECT SUBSTRING(comment, CHARINDEX('', comment) + 1, 100) from tillsummaries
Which does allow me to split a string into one column, but if I put in the next string that I want to be separated(create another select statement with criteria required), it seems to be created on a different table.
(I'm guessing this is because I am actually writing 2 select statements, so they are separate queries)
How am I able to use the substring function to do the following.
Example info comment = "home-55041213-qld"
would like the information to stay in the one table so it would be
col1 = home, col2 = 55041213 col3 = qld