Linked Questions

196 votes
27 answers
712k views

I have a SQL Server 2008 R2 column containing a string which I need to split by a comma. I have seen many answers on StackOverflow but none of them works in R2. I have made sure I have select ...
Lee Grindon's user avatar
  • 2,215
138 votes
16 answers
272k views

I’m looking to split '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15...' (comma delimited) into a table or table variable. Does anyone have a function that returns each one in a row?
jinsungy's user avatar
  • 10.9k
139 votes
11 answers
190k views

Possible Duplicate: Split string in SQL I have seen a couple of questions related to string concatenation in SQL. I wonder how would you approach the opposite problem: splitting coma delimited ...
kristof's user avatar
  • 54k
5 votes
3 answers
36k views

I have a column (full_location_id) in a table that contains a string is delimited by '-' which I need to split up into 4 columns in a view (Test_SplitColumn). Not every record in full_location_id ...
dspencer's user avatar
  • 938
4 votes
2 answers
12k views

I have a question about splitting column values in T-SQL. I have Address_col Nevada,USA Tokyo,Japan Hanoi,Vietnam I want to split the values by comma to Address_col Country Navada ...
aliasosx's user avatar
  • 1,245
0 votes
5 answers
6k views

I have the following variable. DECLARE @TestConnectionString varchar(255) = 'Data Source=123.45.67.890;User ID=TestUser;Password=TestPassword;Initial Catalog=TestCatalogName;Provider=SQLNCLI11.1;...
007's user avatar
  • 2,196
1 vote
3 answers
3k views

I have for example this string name-surname-15A-15B and for example if I want to get the last segment(which is 15B) I can use the following query: Select right(Code, charindex('-', reverse(Code)) - 1)...
Simple Code's user avatar
  • 2,654
0 votes
1 answer
11k views

For instance I have a string parameter @p_colors with a value like: 'yellow','blue','red' which is passed into a stored procedure. And when I try to select it like this: EXECUTE(CONCAT('SELECT ', @...
Red Magda's user avatar
  • 428
4 votes
3 answers
3k views

Possible Duplicate: Split string in SQL Searching a column with comma seperated values In my PHP project I'm facing a problem to write a SQL: I have a table "consultants" with fields categories ...
user avatar
0 votes
3 answers
5k views

am passing in a string of numbers and would like to convert this string into a list of numbers e.g. SELECT personID from person WHERE personID IN ('927,6944') How do I convert ('927,6944') to (927,...
scot0308's user avatar
1 vote
0 answers
7k views

I have a string like so: DECLARE @columnCamera varchar(MAX) = 'aaa,bbb,ccc' and I am trying to split these and loop through, I am stuck on the splitting part: SELECT * FROM STRING_SPLIT(@...
user979331's user avatar
  • 12.1k
0 votes
3 answers
4k views

This is the stored procedure: CREATE PROCEDURE [dbo].[StoredProcedure] @FILTERNAME varchar(100) = '' AS IF @FILTERNAME <> '' BEGIN SELECT CODE, NAMEen, NAMEkr ...
Jungmin Koo's user avatar
0 votes
3 answers
3k views

There is a column containing following e.g. abcd/ef/g/hij. Characters between the / are dynamic not fix. I want to split in a select query the content into 4 separate new columns. The already ...
Sven Müller's user avatar
-1 votes
1 answer
4k views

There is no default split function in SQL Server 2012 that I'm using. I want to split the string (ex: /Folder1/Folder2/) by /. if string is /Folder1/ then output should be Folder1, if string is /...
Liam neesan's user avatar
  • 2,571
0 votes
2 answers
2k views

I cannot use the split_string function and I cannot alter the database to set the compatibility level to what I need. I have a column with the following example values: JohnDoe-123-fakestreet-02-...
Chicken Sandwich No Pickles's user avatar

15 30 50 per page
1
2 3 4 5
18