All Questions
10 questions
4
votes
1
answer
44
views
Parse numbers from text based on relative position to certain substrings
The input is a product code. I want to pull out the "percentage" portion of that code. For example, if the code contains the substring BIO, I want all the numbers that follow it until I hit another ...
3
votes
1
answer
3k
views
Finding the Nth occurrence of character in string
I wrote an SQL Server function which returns the substring before the Nth occurrence of a character.
For example:
...
2
votes
1
answer
102
views
Splitting apart a comma separated list
I have a system that outputs a comma separated string into a single column. I need to grab the individual values out of that list. The list could have random spaces and commas that need to be ...
1
vote
1
answer
117
views
INSERTing a student info record based on form inputs
I want to improve my coding skills. How do I write this code with concatenation
...
6
votes
1
answer
348
views
SQL with SUBSTRING / CHARINDEX
I've got a VARCHAR variable of this kind:
@string = "BLABLA10;GOGOGO30;RES777;ANOTHER;"
(several keyword + number separated ...
2
votes
1
answer
122
views
Implementing SQL function STR
I am writing a piece of code in c# that mimics the behaviour of following SQL function STR in the following case:
...
2
votes
0
answers
523
views
Function to split a given string according to predefined patterns
Here's a function that splits given string according to predefined patterns. It's part of a trigger function used to populate one table from another. I want to be sure that I'm not making any mistakes....
3
votes
3
answers
1k
views
Basic T-SQL to compare two same length strings
I've come up with the following T-SQL to compare similar same length strings.
Example usage would be:
OCR returns a value which is expected to be in the database.
PATINDEX is used to check the value'...
3
votes
2
answers
688
views
Phrases update query
My query is this:
UPDATE `phrases`
SET `phrases`.`count`=(SELECT COUNT(*) FROM `strings` WHERE `string` LIKE CONCAT('%', `phrases`.`phrase`, '%'))
My tables look ...
3
votes
2
answers
15k
views
Splitting a string in an SQL query
BudgetCode is in the format 'xxxx-yyyyy-zzzzz'. This splits it correctly but I think that there has to be a more efficient way.
...