Skip to content

Tag: sql-server

Parse String and Insert Results Into 3 Fields

I have a field in a SQL table that looks like this. It’s literally a file name. I’d need to create 3 new fields and split the string shown above into this. How can I do that? I have this basic SQL that does the select and parsing, but I’m not sure how to do the insert into. I am

While loop SQL Server

Help me please. I need to write two functions, one that calculates the factorial and another that calculates the sums of euler. To make the euler sums I need to use the function that calculates the factory. I already have the function of factorial but when doing the sums the result I get “NULL” No…

Multiple WHEN in CASE only applies first two

I have a CASE with 4 WHENs. The first two applie fine, but the last two (or any others I add past that) do not get applied. All WHENs are referring to the same field. Here’s what I’m trying to do. The field in question is formatted as: So it would look like The first Case I wrote was to

Window functions + self join to solve?

I want to display how many days an item was in each stage. We have many items, so just showing one ID for now for simplicity. For first stage it should be action_date -created time. For last stage it …