Viewing 15 posts - 1,936 through 1,950 (of 59,064 total)
Look into LAG.
https://learn.microsoft.com/en-us/sql/t-sql/functions/lag-transact-sql?view=sql-server-ver16
You could also do a "rolling average" using AVG() OVER but it would likely be much more expensive to do it that way.
February 9, 2023 at 3:03 pm
Ok... since SPAM keeps necroing this 2 decade old thread and someone might read it and without knowing what the cursors are actually being used for, I'll just up and...
February 9, 2023 at 3:00 pm
So where do these linked integers come from? Why, for example, is
1linked to1,2, and3, but the numbers8to14only linked to8?
Apparently,...
February 9, 2023 at 2:54 pm
SSC pulls thru again!
{snip}
Guess who whipped this baby into shape in about 2 days?
Someone who's an obvious and valued resident of the SSC Sanitorium in the DBA Disneyland...
February 9, 2023 at 2:37 pm
Talking about ChatGPT, has anyone seen this one yet? https://www.cnn.com/2023/02/08/tech/google-ai-bard-demo-error/index.html
<headdesk>
Yes... and they're making an big deal about it. ChatGPT is constantly providing incorrect answers about code and people and...
February 9, 2023 at 2:32 pm
The time you're seeing in that image is the time it took to actually make the column change. Try making the actual column change with the INFORMATION_SCHEMA method and see...
February 9, 2023 at 2:12 pm
As a bit of a sidebar, this uses 31% fewer reads, which will come in handy for when the cross joined tables are larger...
WITH
cteProduct...
February 9, 2023 at 6:22 am
Never mind... post deleted because it wasn't necessary. The OP figured it out.
February 9, 2023 at 5:43 am
i think information schema is better because col_length is a function call and finally it would go to sys.objects or all_objects or information schema it self.
This is what I...
February 9, 2023 at 4:55 am
Got the first post on a page again... and again, it's not showing up until another post (this one) is made.
February 9, 2023 at 4:14 am
According to Paul White (and what I heard early on when they first started meta-caching of Temp Tables), dropping the tables does NOT prevent caching of Temp Table meta-data.
https://sqlperformance.com/2017/05/sql-performance/sql-server-temporary-object-caching
February 9, 2023 at 4:13 am
Ha! I may have overly played up the "scary" part of the scarydba occasionally.
I apologize. I didn't intend to embarrass, my dear ol' friend.
February 9, 2023 at 4:01 am
Using your code as a model, you can make it a bit shorter...
IF COL_LENGTH('dbo.abc', 'r1') IS NULL
EXEC ('ALTER TABLE abc ADD... February 9, 2023 at 1:16 am
That’s why I like you Jeff, you’re such a smart guy 😍🥳
Heh... if I were really smart, I'd just up...
February 8, 2023 at 6:40 pm
That’s why I like you Jeff, you’re such a smart guy 😍🥳
Heh... if I were really smart, I'd just up and retire. ...
February 8, 2023 at 6:30 pm
Viewing 15 posts - 1,936 through 1,950 (of 59,064 total)