Viewing 15 posts - 361 through 375 (of 7,608 total)
Maybe try this:
select k.charges,
sum(case when k.range>='101' then charges else 0 end) as '101charges',
sum(case when k.range>='201' then charges else 0 end) as '201charge'
from
(select charges,case when substring(daterange,1,3) like '0-%'...
September 14, 2023 at 6:19 pm
SELECT CAST(SUBSTRING((getFileName, 5, 4) +
LEFT(getFileName, 4) AS date) AS FileNameDate
FROM #t
September 14, 2023 at 2:59 pm
If you can afford to have CASCADE in effect, drop and recreate the index with ON DELETE CASCADE specified.
Hmm, yeah, if not, we'll have some complex code to write. We...
September 12, 2023 at 6:50 pm
If you are going to do that -- and then keep modifying that index endlessly as the base query add columns and otherwise changes -- you might as...
September 12, 2023 at 5:35 pm
If you are going to do that -- and then keep modifying that index endlessly as the base query add columns and otherwise changes -- you might as well do...
September 12, 2023 at 5:17 pm
It depends, but, yes, if this query is vital for you, then change the clustering key to ( registration_date, UserID /*assuming a unique UserID*/ ) (the PK can still be...
September 12, 2023 at 4:57 pm
SQL itself will delete from the FK-related tables if you "tell" it to: that is, you set the ON DELETE CASCADE option on for that FK.
September 12, 2023 at 4:54 pm
Great, glad that resolved it. Autoclose on or taking the db offline were the only things I could think of that would cause that to happen.
September 7, 2023 at 4:46 pm
I believe heaps do show up, just under index_id 0 rather than 1.
September 6, 2023 at 7:45 pm
OK, I finally found notes on the sys view I was trying to remember:
sys.dm_db_file_space_usage
This time, that should (actually) help you determine what you need to know (you would likely need...
September 6, 2023 at 7:23 pm
So sorry, obviously I didn't look closely enough.
I can't imagine the db has autoclose on or that the db is taken offline, so, yeah, that is really weird.
September 6, 2023 at 6:12 pm
Take a look at sys.dm_db_index_usage_stats, it should give you what you want.
September 6, 2023 at 3:12 pm
With the exception of random but evenly distributed indexes, I wouldn't use logical fragmentation to determine if an index needs to be rebuilt. In the case mentioned, you actually...
September 5, 2023 at 3:09 pm
Wrap the value in a: FLOOR, CEILING or ROUND(,0) function, depending on how you want to handle the decimal part of the value.
August 31, 2023 at 3:42 pm
There's not a lot of data left in the file, so I'm rather surprised it would take that long to shrink it, since SQL wouldn't need to move that much...
August 28, 2023 at 6:08 pm
Viewing 15 posts - 361 through 375 (of 7,608 total)