Stack Exchange
log in
users (24)
rooms (26)
faq
JNK
general
recent
conversations
The Heap™ – Consultancy ©®
General on- and off-site discussion for
dba.stackexchange.com
....
7
JNK
Mar 6, 2018 15:25
yes, you know? Or yes, it locks?
JNK
Jan 18, 2018 19:44
morning Paul
JNK
Jan 18, 2018 17:23
listen I have a fondness for XML in SQL Server :P
JNK
Jan 18, 2018 17:23
wow what was he trying to do
JNK
Jan 18, 2018 16:54
Yeah I'm the worst, sorry
JNK
Jan 18, 2018 16:49
I'm boring every day
JNK
Sep 15, 2017 20:10
@202_accepted it can matter, depending on your use case...if the fragmentation leads to splits etc you are doing a lot more IO than strictly necessary to pull your data
JNK
Sep 15, 2017 20:09
also if you use SSDs it won't matter much anyways
JNK
Sep 15, 2017 20:05
Fragmentation doesn't necessarily matter for all applications
JNK
Sep 15, 2017 19:43
@202_accepted yeah that may be good, could be overkill unless this is for a data warehouse
JNK
Sep 15, 2017 19:38
b/c if youre gonna do it may as well break out stuff like day of week, day of month, month number, day of year, etc etc
JNK
Sep 15, 2017 19:38
look up one so you get the important stuff
JNK
Sep 15, 2017 19:38
and calendar tables are pretty easy
JNK
Sep 15, 2017 19:37
your join criteria is the same
JNK
Sep 15, 2017 19:37
for your query you just need the COUNT(RangeTest.RangeID) instead of the conditional
JNK
Sep 15, 2017 19:36
could also do a SUM(CASE ... THEN 1 ELSE 0 END) for the same check
JNK
Sep 15, 2017 19:36
that's what my count gives you
JNK
Sep 15, 2017 19:33
yeah you could but what do you need from rangetest
JNK
Sep 15, 2017 19:32
not sure on join criteria there tho
JNK
Sep 15, 2017 19:32
SELECT DateCol, DATEADD(day, 60, Datecol), COUNT(CASE WHEN SomeDate BETWEEN DateCol AND DATEADD(day, 60, Datecol)) FROM CalendarTable ct
JNK
Sep 15, 2017 19:29
well the calendar table would work for your first day
JNK
Sep 15, 2017 19:29
if you need to iterate over a series of days it's a calendar table or a loop of some sort
JNK
Sep 15, 2017 19:28
sooooper easy to do
JNK
Sep 15, 2017 19:28
yeah calendar table
JNK
Sep 15, 2017 19:28
where do you get the range start and end values
JNK
Sep 15, 2017 16:44
people don't seem to get less confused over time do they?
JNK
Sep 15, 2017 15:28
@Zane I had some recently on like 6 year old answers.
JNK
Sep 14, 2017 21:40
...or the automatic typing in powershell
JNK
Sep 14, 2017 21:40
@PaulWhite that's like some Javascript logic
JNK
Sep 14, 2017 13:22
"Oh I can just do a PS script for that!"
JNK
Sep 14, 2017 13:22
they all look like nails :)
JNK
Sep 14, 2017 13:21
definitely a golden hammer issue though
JNK
Sep 14, 2017 13:21
once you're competent there's very few things you can't bang out in an hour or two to see if it works
JNK
Sep 14, 2017 13:20
it's very easy to prototype stuff in
JNK
Sep 14, 2017 13:20
well being able to write .NET code without a compiler is SUPER HANDY
JNK
Sep 14, 2017 13:19
you don't want to cut your hair with the little scissors in a SA knife but you can use them in a pinch
JNK
Sep 14, 2017 13:19
I describe it to people like a swiss army knife. It can do almost anything but it's not the best tool for any specific task usually
JNK
Sep 14, 2017 13:19
@PaulWhite yes to all
JNK
Sep 14, 2017 13:18
:)
JNK
Sep 14, 2017 13:17
so Erik if you get stuck on PS again ping me
JNK
Sep 14, 2017 13:15
it's almost always faster than cmdlets
JNK
Sep 14, 2017 13:15
if you feel fancy you can also use .NET classes for this stuff
JNK
Sep 14, 2017 13:14
powershell is fantastic but there's wayyyyyyyyy too many tools in the toolbox
JNK
Sep 14, 2017 13:13
<themoreyouknow.gif>
JNK
Sep 14, 2017 13:13
technet.microsoft.com/en-us/library/ee156791.aspx
JNK
Sep 14, 2017 13:12
@sp_BlitzErik have you not heard of
add-content
?
JNK
Sep 14, 2017 13:10
@PaulWhite I heard about that! Everyone's talking about it.
JNK
Sep 14, 2017 13:09
I'm the accidental DBA who can keep things running but I'm not gonna do a migration or anything
JNK
Sep 14, 2017 13:08
but my skillset is more with powershell and TSQL than with administration
JNK
Sep 14, 2017 13:08
Well now I know that!