Hi there,
I'm quite new in MSSQL. I'm having problems creating my
custom query in MSSQL syntax.
Background: I need to separate the string value of one field into separate columns. See example below.
OriginalField
TRUE,FALSE,Victoria,Phone,"Application Today",...
I need to create a query (select statement) to separate these values into different columns.
Field1 Field2 Field3 Field4
TRUE FALSE Victoria "Application Today"
My problem: there are about 30 comma-delimited values in the original field. Its hard to manually hard code as the length of each comma-delimited value is not fixed.
I've been playing around with the charindex and substring function to create this query. But I observed that charindex doesn't have the flexibility of the instr function of Oracle which makes it difficult to separate each values.
In Oracle the instr function has a optional third argument wherein you can specify the nth occurence of the comma.
Appreciate any help. Thanks in advance.
Regards,
Chris
I'm quite new in MSSQL. I'm having problems creating my
custom query in MSSQL syntax.
Background: I need to separate the string value of one field into separate columns. See example below.
OriginalField
TRUE,FALSE,Victoria,Phone,"Application Today",...
I need to create a query (select statement) to separate these values into different columns.
Field1 Field2 Field3 Field4
TRUE FALSE Victoria "Application Today"
My problem: there are about 30 comma-delimited values in the original field. Its hard to manually hard code as the length of each comma-delimited value is not fixed.
I've been playing around with the charindex and substring function to create this query. But I observed that charindex doesn't have the flexibility of the instr function of Oracle which makes it difficult to separate each values.
In Oracle the instr function has a optional third argument wherein you can specify the nth occurence of the comma.
Appreciate any help. Thanks in advance.
Regards,
Chris