Viewing 15 posts - 1,126 through 1,140 (of 2,648 total)
Another option would be to create a view or user-defined function or table-valued function. I'm not sure if this would be any more efficient without you testing.
User defined function:
February 17, 2020 at 2:04 pm
No, this won't work. As I said before, you can't have aggregate functions in the recursive part of a recursive CTE.
Ok, I see and agree.
So did your initial query...
February 17, 2020 at 1:41 pm
CREATE VIEW [dbo].[vRecipe] AS
WITH RECIPE_DBVARE (OPNR, DOPNR, ANTL, ANT, ANTS, SVIND, RVNR, RVNAVN, TYPE, NIVEAU, PARENT, LINE, PLINE)
AS
(
SELECT VR.NR ...
February 17, 2020 at 12:16 pm
I don't understand why you are getting an overflow error when selecting from the table but not from the CTE?
Surely they add up to the same value wherever you do...
February 17, 2020 at 11:41 am
Why is it that you are not using:
OUTER APPLY (SELECT SUM(ANT) as SUMANT
...
February 17, 2020 at 11:28 am
Mauricio, Can you post the current version of the SQL code you are using?
February 17, 2020 at 11:02 am
I have attached a small sample expected output as CSV and a screen shot. Level 2 & 3 are only one row but the other rows can be one...
February 17, 2020 at 12:10 am
I don't quite understand the purpose of this code:
OUTER APPLY (SELECT NR,
...
February 16, 2020 at 9:46 pm
I don't quite understand the purpose of this code:
OUTER APPLY (SELECT NR,
...
February 16, 2020 at 8:58 pm
You can't rely on the percentage figures given in an execution plan. I rely on SET STATISTICS IO, TIME ON and try to minimise the figures given in that.
Can you...
February 16, 2020 at 8:01 pm
Just put it in an OUTER APPLY:
Into POInfo
From MeritusMmPO as PO
Left Join MeritusMmPOLines as POL
ON PO.SourceID = POL.SourceID AND
PO.PurchaseOrderID = POL.PurchaseOrderID
OUTER APPLY(SELECT POC.SourceID,
...
February 14, 2020 at 10:29 pm
Couldn't you just write it without PIVOT like this?
;with MeritusMmPoComments as
(
Select * FROM (VALUES
('WAC', 494819,1,'ALL','Joe Fleichman/81-2035','2017-08-30 13:14:00'),
...
February 14, 2020 at 9:36 pm
If you give an example of the input you have and the output you expect I might be able to help. From your description I can't really work out what...
February 14, 2020 at 8:52 pm
In situations like this SQL Server will use the most local column it can find if there are no aliases. So if the column name is present on both #PROVINCES...
February 14, 2020 at 1:22 pm
Your query is equivalent to this:
SELECT *
FROM #CITIES
WHERE ProvinceCode IN (SELECT ProvinceCode
...
February 14, 2020 at 11:50 am
Viewing 15 posts - 1,126 through 1,140 (of 2,648 total)