Skip to content
Advertisement

Tag: sql-server-2016

How to generate a Forecast based on last row result in SQL

I need help to develop the proposed task: I need to count the current month active employees and then generate a “forecast” for the next six months, the forecast is just the last total active from the current month over the next six months, just changing the date value on the result. Expected Result: Date_Active Location Total_Active Forecast 2021.04 127

Splitting up events that occur over the day boundary

I have a table of events with a start time and an end time, with some events that have a start time before midnight and an end time after midnight. I’d like to produce output that splits up these events at the midnight barrier so they can be counted toward their respective date. The above table could be produced by

Append data from one table to another table

I have a Destination table with 3 columns, ID, Name, Source. I have 10+ Source tables, each with multiple columns, but I only require the ID, Name, and the table name itself to be appended into Destination table. Do note the naming of the column names are different in each table, but the required ID and Name are of the

SQL Server: NULL or empty string?

I have a a database column whose value is determined programmatically and is not affected by user input. The value is never an empty string; it’s either NULL or a non-0 length string. The column is …

Advertisement