Skip to content
Advertisement

Tag: split

Check whether a number is in a string range

I have a table ID Count Range 1 33 1-100 2 120 101-200 3 155 201-300 The Range is a string that can only have the values 1-100, 101-200, 201-300. I need to write a query that checks whether the count and the range fits, so 155 should pop up. My idea was: but this does not work. Can anyone

Extract first argue from column with T-SQL

I need to extract the first argument: “PATHTOPACKAGE” from the string below: which is a column stored at SQL Server msdb.sysjobsteps.command Is there a way to do it by using Regex or Spliting it by blank spaces? Answer Based on the one example we have, a couple of CHARINDEXs a little bit of simple string manipulation gets the job done:

SQL function to generate new row per event?

I’ve looked for an answer here to no avail; wondering if this problem is best suited outside SQL environment but thought I’d see how it could be solved. I’m trying to look at web journeys and as a result need my data to be in the following format: At present the data is in the following format: I essentially want

Reverse to STRING_AGG

Here is a sample data on which we are further processing. My question is, is there any exact reverse of the STRING_AGG function for SQL Server? Like I am merging using STRING_AGG with the following code I need to reverse the process but I had to use CURSOR so I am searching for an alternative solution. Below is the cursor

Advertisement