Viewing 15 posts - 1,111 through 1,125 (of 2,648 total)
I think there is a mistake in your question. The SQL you described that works is exactly the same as the SQL you say is giving you an error:
February 24, 2020 at 2:13 pm
Jeff, Here is the data in a consumable format. I couldn't work out from the question exactly what's wanted so I'll leave it to someone else.
Except for a...
February 22, 2020 at 11:03 pm
Jeff, Here is the data in a consumable format. I couldn't work out from the question exactly what's wanted so I'll leave it to someone else.
;with Episode...
February 22, 2020 at 2:51 pm
You could also do it all in a single statement with a recursive CTE:
;WITH rCTE AS
(
SELECT a.RcvDt,
...
February 22, 2020 at 12:43 am
Scott's answer looks correct, the UPDATE is potentially updating the FromDate with the FromDate of a row it has previously just updated (which also could have been updated with...
February 21, 2020 at 11:53 pm
Normally data feeds have a specification that will specify the maximum length of a column and whether or not it's mandatory etc...
Make a column not null if it's mandatory.
February 21, 2020 at 4:07 pm
My guess is that there is another process reading the table with a lock on it and running all the SQL commands contained in the SQL_DETAIL column. Your UPDATE statement...
February 21, 2020 at 11:56 am
I ran your original view on the backup you've just provided and it returned all rows (626387) in 1.4 seconds.
select * into #a from dbo.RECIPE
February 20, 2020 at 1:13 am
So, from your point of view, in this case it's better to use UNION ALL even when some levels are not used than to use a recursive CTE?. I...
February 19, 2020 at 1:30 pm
No, I think that's because I had some problems executing the script for exporting data (it was too huge). In my databases both views produce the same result.
Well, there's...
February 19, 2020 at 1:05 pm
I also think they are logically different queries and produce different results. I ran the original query and it returned over 400k rows (in over 20 minutes). The rCTE version...
February 18, 2020 at 11:38 am
I added these indexes:
CREATE NONCLUSTERED INDEX [IX_DBRVARE_NR_INC_NAVN_TYPE]
ON [dbo].[DBRVARE] ([NR])
INCLUDE ([NAVN],[TYPE])
CREATE VIEW [dbo].[vwDBDOPSKSumant]
WITH SCHEMABINDING AS
SELECT DOP.NR,
SUM(ISNULL(DOP.ANT,0)) SUMANT
...
February 17, 2020 at 10:45 pm
I think the indexed view I suggested on dbo.DBDOPSK will reduce the reads on that that table.
For dbo.DBRVARE, I would try adding an index on column (NR) and INCLUDE (all...
February 17, 2020 at 5:45 pm
That's an interesting alternative. Right now, as I said before, CTE view performs better if you filter for one of the first 2 columns. However, if you just SELECT...
February 17, 2020 at 2:52 pm
I will try them and let you know. I like more the TVF than the function in this case. Right now, view is working fine but I'm facing a...
February 17, 2020 at 2:44 pm
Viewing 15 posts - 1,111 through 1,125 (of 2,648 total)