Viewing 15 posts - 1,141 through 1,155 (of 7,191 total)
I don't have DDL or sample data for your dept table, so I can't test, but something like this:WITH TimesasInt AS (
SELECT
...
November 1, 2017 at 10:55 am
d and ISNULL(c.Folldate, '01-jan-1900') are the first two arguments of the DATEDIFF function. d means days, and ISNULL(c.Folldate, '01-jan-1900') means c.Folldate unless it's NULL, in which case 1st January 1900. So...
November 1, 2017 at 10:24 am
November 1, 2017 at 9:19 am
sample data in the form of INSERT statements
... and if you don't even include in your sample data the columns that are in your query, we really aren't...
November 1, 2017 at 8:57 am
Chop the last three digits off of calltime so that you're left with just the hour portion, which you can convert to an integer and do proper arithmetic on. Please...
November 1, 2017 at 6:53 am
Before you change the application's connection string, do yourself a favour and create a DNS alias for the new server. Call it SQLMyApplication or something that fits your organisation's connection...
November 1, 2017 at 4:41 am
COUNT doesn't need an ORDER BY in the OVER clause. And as you and I have just learned, not only is it not needed, it's not permitted either.
[code...
November 1, 2017 at 3:52 am
What indexes do you have on table1, table2 and tbl_needs_ranking?
Have you considered something like this - doing the ranking and both inserts all in one operation? Your transaction...
October 31, 2017 at 10:01 am
Last full backup nine months ago is not a good situation to be in. It looks as if that may be the best you can do, though. Restore that -...
October 31, 2017 at 6:55 am
Chris
Good spot. I saw that when I looked in the execution plan. What still puzzles me, though, is that my code runs about three times as fast with...
October 31, 2017 at 4:16 am
Arshad
Have you looked at the LAG function? Why can you not use CTEs, incidentally?
John
October 30, 2017 at 10:55 am
Goodness, yes - I tried it with an on-the-fly table. Mine slowed down significantly and yours sped up a lot. I can't really explain that.
I changed the tally...
October 30, 2017 at 10:38 am
Chris
Yes, you appear to have changed my PARTITION BY clauses. The first one should be PARTITION BY name, CHR; the second should be PARTITION BY...
October 30, 2017 at 9:50 am
Chris
Your code is certainly more compact, but I couldn't find any way to make it faster than mine. I don't know whether that's to do with all the...
October 30, 2017 at 8:40 am
Viewing 15 posts - 1,141 through 1,155 (of 7,191 total)