Viewing 15 posts - 1,501 through 1,515 (of 2,645 total)
SELECT LEFT(SCHID, x.Pos - 1) [Id],
REPLACE(SUBSTRING(SCHID, x.Pos + 1, 8000),',','|') [AdditionalIds]
FROM #X1
CROSS APPLY(VALUES (CHARINDEX(',', SCHID))) x(Pos)
July 11, 2019 at 3:32 pm
I think it actually increases fragmentation, because records are typically added in increasing date order rather than decreasing date order. It improves efficiency, because the index is organised in...
July 11, 2019 at 1:07 am
I've created some test code, not realistic, but the CTE with SELECT TOP(1) is over ten times faster, though has more logical reads.
I also notice that you...
July 10, 2019 at 8:26 pm
I've created some test code, not realistic, but the CTE with SELECT TOP(1) is over ten times faster, though has more logical reads.
set statistics io, time off
set...
July 10, 2019 at 5:10 pm
Hi Michael, The indexes recommended by SQL Server are not always the best, the index you would need to try is:
CREATE NONCLUSTERED INDEX [IX98_SampleData3]
ON [dbo].[SampleData2] (ACC,[Name],[Ref],[DATE]) INCLUDE...
July 10, 2019 at 4:20 pm
Here's a method that doesn't use ROW_NUMBER()
It also requires two scans of the table and is approximately twice as expensive as a result. It will always perform...
July 10, 2019 at 2:26 pm
SELECT [id],
Stuff((SELECT ',' + [VALUE]
...
July 10, 2019 at 1:54 pm
You could be missing some curly brackets from column form_line1.
Try running this to see if there are any invalid values in column form_line1
select f.form_line1
from s1for_formula f
where f.form_line1...
July 10, 2019 at 1:21 pm
If you are doing that many databases, wouldn't you be better off generating a script to create them? Then you'd just need one click to create them all.
July 10, 2019 at 12:50 pm
If you press the left-arrow it goes back to the Databases node.
July 10, 2019 at 12:22 pm
Here's a method that doesn't use ROW_NUMBER()
;WITH CTE AS
(
SELECT DISTINCT SD2.Name,
SD2.ref
...
July 10, 2019 at 12:12 pm
In my experience, the size of the backup is reduced to about 1/6 that of a non-compressed backup.
It does, of course, depend on the contents of your database. If you...
July 9, 2019 at 1:47 pm
Yes, that was one thought. I don't really understand why that query is taking 7 seconds to complete when it's just reading an index with two 14 character columns on...
July 5, 2019 at 4:14 pm
It's only reading the index so it seems about as efficient as it could get.
Have you tried rebuilding the index?
July 5, 2019 at 12:04 pm
Could be the statistics need updating and the plan it uses with the parameters is a better plan.
You should look at the execution plan of both queries.
July 3, 2019 at 7:01 pm
Viewing 15 posts - 1,501 through 1,515 (of 2,645 total)