Viewing 15 posts - 1,096 through 1,110 (of 1,396 total)
You're right tho it could be simpler
with
range_cte(EMployeeID, TranDate, NewStatus, EndDate) as (
select
EMployeeID, TranDate, NewStatus,
...
March 25, 2020 at 2:41 pm
What is the necessity of dateadd/datediff functions here?
Lead gets you the next date and from what ive seen in the daterange post, it accepts 2 dates aswell.
So why not...
March 25, 2020 at 2:29 pm
drop table if exists #EMployeeStatus;
go
create table #EMployeeStatus(
EMployeeID Int,
TranDate datetime,
OldStatus varchar(50),
NewStatus varchar(50));
go
insert #EMployeeStatus(EMployeeID, TranDate, OldStatus, NewStatus) values
(12345657, '07/11/2018', 'SUSPENDED', 'ACTIVE'),
(12345657,...
March 25, 2020 at 12:19 pm
select * from sys.database_scoped_configurations;
This tells the settings. Since for a while identity_cache ON has been the default. I checked Azure Sql is set to ON by default. ...
March 24, 2020 at 5:45 pm
In the DDL provided:
[event_id] [float] NULL
[race number] [tinyint] NULL
Are these 2 of the 3 columns to be included in the ORDER BY? Which column corresponds to expr1003?
March 24, 2020 at 5:25 pm
Sorry I should've also asked which are the ORDER BY column(s)? The window has 2 parts 🙂
March 24, 2020 at 4:51 pm
basically what I need to do is to summarize the count of column "count2" for a every partition, and then subtract it to the field in "lead2" so, with...
March 24, 2020 at 4:12 pm
This uses the daterange function from this article: https://www.sqlservercentral.com/scripts/a-daterange-table-valued-function
March 23, 2020 at 5:06 pm
drop table if exists #tblTest;
go
create table #tblTest
(ename varchar(10),
Amount float,
eDate date);
go
insert #tblTest values
('ABC',615.00,'03/23/2020'),
('ABC',540.00,'03/23/2020'),
('ABC',207.00,'03/23/2020'),
('PQR',449.00,'03/23/2020'),
('PQR',1065.00,'03/23/2020'),
('PQR',-2435.00,'03/23/2020');
declare
@max_dt ...
March 23, 2020 at 5:05 pm
Afaik and imo there are no pros only cons. There is no such thing as a "gap" in a primary key because 'unit consistency' is not a necessary...
March 23, 2020 at 4:37 pm
Afaik and imo there are no pros only cons. There is no such thing as a "gap" in a primary key because 'unit consistency' is not a necessary attribute. Maybe...
March 23, 2020 at 1:18 pm
I prefer to always use INNER and OUTER for clarity.
Clarity could not also come from conciseness? It seems to me adding extra information which is of questionable necessity adds...
March 19, 2020 at 9:10 pm
Steve and Jeff, thank you. Good to have other eyes on this. 🙂 What should I do with the earlier incorrect code? Wipe it out? Should I have kept updating...
March 19, 2020 at 8:33 pm
If dupes are ok but the alerttypeid may only be in (4, 6), then maybe this works
with only_two_cte(alertid) as (
select
...
March 19, 2020 at 7:54 pm
with only_two_cte(alertid) as (
select
alertid
from
#aaa
...
March 19, 2020 at 7:43 pm
Viewing 15 posts - 1,096 through 1,110 (of 1,396 total)