Linked Questions

2 votes
3 answers
11k views

SQL - Convert text to a list of numeric values [duplicate]

Looking for SQL code to transform the text string '12,13,14' to this list of numbers +----+ | 12 | +----+ | 13 | +----+ | 14 | +----+ Example: table0.params (varchar) field contains this text: 12,...
Stefan Colosimo's user avatar
1 vote
2 answers
4k views

Splitting a column on underscores [duplicate]

What SQL syntax would split this column into three new columns (split would be on the underscore)? There are other columns in the table, but I would like to split these into three (underscore based).
CalgaryCoolCat's user avatar
-4 votes
1 answer
3k views

Split hyphenated nvarchar value [duplicate]

I have a table with 6 columns one of which is a NVARCHAR (65) datatype. All of the entries in this table have the format XXXXX-nnnnnn. I want to be able to use the '-' as a delimiter and construct a ...
zapcon's user avatar
  • 73
0 votes
1 answer
1k views

How to split list of values into multiple rows after semi-colon? [duplicate]

I'm thinking this is easy, but I'm having a hard time manifesting. I have a list of values, e.g. @bob @sarah @kelly;john @denver_colorado @james12;kellybelly I want the list to be: @bob @sarah @kelly @...
teddy's user avatar
  • 11
-7 votes
1 answer
174 views

Split after comma into separate row [duplicate]

id name books 1 dan history,physics,english 2 ron chem,social,biology 3 mon it,ece,eee I need an output as id name books 1 dan history 1 dan physics 1 dan english 2 ron chem 2 ron ...
Vineet Davis's user avatar
1 vote
1 answer
92 views

SQL server - parsing element of delemiated string [duplicate]

I have delimited string like this 'test1:test2:test3:test4:test5'. I need to get the third and forth values one value at a time. The string always has five values.
Haya's user avatar
  • 29
0 votes
0 answers
46 views

How to Split string into multiple values using best approach [duplicate]

We are trying to save result of a query in database by tokenizing a column but query is taking more than 3 minutes to finish his objective. My question is, do we have any faster way to tokenize a ...
AA.SC's user avatar
  • 4,073
3 votes
3 answers
24k views

Excluding particular words from a string on a WHERE clause

I have a table that stores invoices and I'm trying to get stats out of it, unfortunately the table is poorly build and some crucial information is all mixed up on a nvarchar field, information such as ...
Nelson's user avatar
  • 1,689
3 votes
2 answers
23k views

How to separate name string by the spaces in the name in T-SQL

I have a list of names, such as: Doe John James, Doe Jane and Doe Henry Albert Sr I need to split those out into the four component parts of the name (if the name has four parts) to put each of them ...
marky's user avatar
  • 129
0 votes
1 answer
9k views

What is the correct SQL for using where ID in List and the items are with AND operator

I need a SQL Statement to use IN operator within the items with "And" connected. SELECT * from tbl_Users WHERE id in [1,2,3] is equivalent to: SELECT * from tbl_Users WHERE (id=1) or (id = 2) or (...
user3213767's user avatar
1 vote
2 answers
2k views

Dealing with data stored as arrays in a MySQL DB

So I know storing arrays in a DB field is wrong and would never do it myself, however a 3rd party plugin my company is using stores data in an array and I was wondering if you could help me try to ...
user2458948's user avatar
0 votes
1 answer
880 views

Select All Instances of Substring in a String

I have a varchar(max) column that holds a JSON request string. I need a SQL statement for a report that will select all of the instances of that substring. More specifically I need to grab the LoanId ...
Tim's user avatar
  • 155
1 vote
1 answer
704 views

Get all the data between Characters [closed]

I am trying to extract all the variable from the following string; string = 'factor1|factor2|factor3' This is just a test string. In real string, I do not know the number of factors. What I want is ...
Name changed to mask identity's user avatar