All Questions
12 questions
2
votes
3
answers
790
views
Generate date sequence in T-SQL
In a record of purchases, I want to generate a sequence of +/-12 months out of a base date
Client Date
Joe 2020-03-15
Maria 2019-11-01
so the desired outcome would be
Client Date
Joe 2019-...
0
votes
3
answers
81
views
Dynamic Dates SQL Server
I have the below data in SQL.
I need to figure out a way dynamically to get the next dates based the 2 values below. The remaining doses tells me how many dates I will need to find and RXDAYS tells me ...
0
votes
1
answer
2k
views
Split a single row into multiple rows based on date range in sql server
my SQL server table structure is some what like below
FROM_Currency To_Currency ExchangeRate StartDate EndDate
EUR GBP 33.5 2018-03-31 2018-04-30
USD ...
0
votes
2
answers
585
views
how to generate a table of Monday dates that from a specific Monday to current date in sql
In SQL Server I need to generate a table of Mondays up to the current date.
The starting date is always 2020-04-27, which is a Monday.
For example, if today is 2020-05-25, I need a table like below:
...
0
votes
1
answer
233
views
SQL Server Fill Month Gaps in Groups
I have a table for example like below:
declare @test table(Aid int, Bid int, CheckMonth date, Avalue decimal(18,2))
insert into @test (Aid, Bid, CheckMonth, Avalue)
values (1, 4, '2014-07-05', 123....
0
votes
1
answer
44
views
Want to make iteration in two dates related to other data
i have a view in sql server database that has the attendance for employee and the data stored like this
------------------------------------------------------------------
ID | EmpID | Name | ...
0
votes
1
answer
628
views
SQL create rows with dates at the end of quarter from rows with two dates
I have at table, where i need to create a new table based on two dates in the first table. The first table looks like below with the date format YYYY-MM-DD:
Start date | End date | Data
2015-09-01 ...
0
votes
1
answer
88
views
SQL split consumption full Month
I have a problem. I would like to split a value for a full month.
I have the daily consumption and the Starts and End Dates like in the example:
And I would like to split the value for each month ...
2
votes
2
answers
8k
views
The maximum recursion 100 has been exhausted
When I run this query I am getting error when I increase the date to be above months
with calender_cte as (
select convert(date, '2019-01-01') as startdate, convert(date, '2019-12-31') as ...
1
vote
2
answers
40
views
How do I extract dates within a range?
I have a table (SQL Server 2017) containing data within a date range.
+---------+----------+------------+---------------+-------------+
| good_id | store_id | promo_name | date_id_begin | date_id_end ...
1
vote
1
answer
312
views
Rolling total in SQL that Resets to 0 when going above 90
First time post. Learning SQL over the past 6 months so help is appreciated. I have data structured as below:
DECLARE @tmp4 as TABLE (
AccountNumber int,
Date date,
DateRank ...
0
votes
2
answers
2k
views
Generating Sequential Months in SQL
I have a table like below sample:
code | date | value
1000 2016-08-05 5000
1000 2016-12-27 8000
1000 2018-03-19 6000
1000 2018-06-02 6000
Now I need to generate sequential ...