Viewing 15 posts - 541 through 555 (of 4,087 total)
If you're really on SQL 2017, why aren't you using String_Agg()
?
Drew
May 6, 2019 at 3:25 pm
Several months ago, someone took over development of our SSRS reports from me. I had set up all of my reports using shared data sources. When she took over, she...
April 30, 2019 at 10:22 pm
This is a standard gaps and islands problem, but it can also be solved with LEAD()
/LAG()
.
Drew
April 30, 2019 at 7:27 pm
As I said,
yyyy-MM-dd
isnotambiguous because(small)datetime
treats the value different, and can give the wrong result. For me, If I use the following statement:
The confusion is...
April 30, 2019 at 3:32 pm
You're missing a FETCH NEXT
inside your cursor. That being said, you'll be better off in the long run if you fix your trigger rather than trying to work around...
April 24, 2019 at 6:37 pm
I wouldn't use a tally table for this problem. It's a variation on the interval packing problem. I believe that this works for the data given, but it might not...
April 22, 2019 at 7:00 pm
Does this work for you
;WITH cte_test
AS ( SELECT *
, ROW_NUMBER() OVER (PARTITION BY clientid ORDER BY ClientImportsId...
April 10, 2019 at 9:51 pm
-- Drop target scratch table if it already exists:
IF OBJECT_ID('tempdb..#OPCantBeBothered') IS NOT NULL
DROP TABLE #OPCantBeBothered
;
-- Create scratch table:
CREATE TABLE #OPCantBeBothered
(
AccountNo INT,
VersionNo INT,
Amount INT,
StatusDate...
April 10, 2019 at 9:45 pm
It sounds like you want something like this:
SELECT …
FROM AccountProfile ap
WHERE EXISTS
(
SELECT AccountNumber
FROM AbsPlan a
WHERE a.AccountNumber = ap.AccountNumber
AND a.AccountStatus = 'Open'
UNION ALL
SELECT AccountNumber
FROM RitPlan r
WHERE r.AccountNumber =...
April 9, 2019 at 7:40 pm
PIVOT
PIVOT is too restrictive for what the OP is trying to accomplish, because it only allows one aggregate function, and you need a MIN()
and a MAX()
.
Drew
April 8, 2019 at 10:14 pm
Subtract a ROW_NUMBER() from the date to get the group for consecutive dates. I'll let you work out the details of the ROW_NUMBER() since you said you preferred clues to...
April 5, 2019 at 10:09 pm
Use LAG()
or LEAD()
.
Drew
April 4, 2019 at 4:08 pm
I wpuld like to get the following columns DC, prepaid, collect, WMItem, ItemDescription on the same row by Hdrid + RID. I'm not sure if this is clear or...
April 2, 2019 at 9:32 pm
Do you have an example of a page that's redirected you to that?
I'm currently getting that message when trying to view my own profile.
Drew
April 2, 2019 at 5:48 pm
I don't see anything that requires an UNPIVOT
. What are your expected results?
Are you trying to create an EAV table? That's highly discouraged.
Drew
April 2, 2019 at 5:36 pm
Viewing 15 posts - 541 through 555 (of 4,087 total)