Viewing 15 posts - 4,111 through 4,125 (of 7,614 total)
I assumed a physical tally table, column name "N" (ugh!, but most common I guess), to avoid having to use an inline CTE:
DECLARE @start_date datetime
DECLARE @end_date datetime
SET @start_date = '20160101'
SET...
October 5, 2016 at 3:26 pm
My best guess is something like this:
UPDATE sc
SET column_x = ISNULL(sot1.value, '') + ISNULL(sot2.value, '') + ISNULL(sot3.value, '')
FROM dbo.SaltoCardholders sc
LEFT OUTER JOIN dbo.some_other_table1 sot1 ON sot1.lookup_col = sc.loc
LEFT OUTER JOIN...
October 5, 2016 at 2:48 pm
The most important thing is to:
Cluster the dbo.FreightRate table on ( SourceKey, CompanyKey, PackingType ).
But you could adjust the query slightly also:
SELECT COALESCE(fr1.FreightRate, fr2.FreightRate, fr3.FreightRate, 0)
FROM dbo.Sales s
LEFT JOIN dbo.FreightRate...
October 5, 2016 at 2:40 pm
To be fair, the number of databases would have an impact here. I've got servers with hundreds (and hundreds) of dbs. Even small files add up to a...
October 4, 2016 at 3:17 pm
drew.allen (10/4/2016)
ScottPletcher (10/4/2016)
October 4, 2016 at 3:10 pm
Create a proc in the master db, beginning the name with "sp_", mark that proc as a system object, then use sp_MSforeachdb to run the proc in the db(s) you...
October 4, 2016 at 2:18 pm
DECLARE @start_date datetime;
DECLARE @end_date datetime;
SET @start_date = '20010101';
SET @end_date = '20010101 23:00';
;WITH tally10 AS (
SELECT number FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) tally(number)
),
tally1000 AS (
SELECT ROW_NUMBER()...
October 4, 2016 at 11:24 am
Sorry, just now have time to follow up on this.
CROSS APPLY (CA) really is a type of join, I'm just co-opting it here to assign names to values. You...
October 4, 2016 at 10:20 am
I think messing with DATEFIRST when you don't absolutely have to is just asking for issues later. The CROSS APPLYs are used just to simplify the main SELECT list...
October 3, 2016 at 2:39 pm
thomashohner (9/30/2016)
September 30, 2016 at 2:19 pm
thomashohner (9/30/2016)
WOW, you have to be joking. 14 seconds row count on the money. Attached is the execution plan.Thank you both so very much. Holy molly :-D:-D
Great, glad it...
September 30, 2016 at 1:36 pm
Try this:
...
Ethnicity,
MaritalStatus,
...
September 30, 2016 at 12:00 pm
In this case, I think it's ok to add the current status to the Orders table, using an efficient, well-written trigger to maintain the status.
However, the lookup of the current...
September 30, 2016 at 11:28 am
I can't see any of the indexes, but perhaps you can combine the Lists lookups as below.
Also, you'll probably get best performance by clustering the Lists table by ( Databasekey,...
September 30, 2016 at 11:21 am
ramana3327 (9/30/2016)
Will there any performance impact by reducing the mdf file size?
Probably not, if the space was never used.
The way to try to shrink with no fragmentation is to use...
September 30, 2016 at 11:00 am
Viewing 15 posts - 4,111 through 4,125 (of 7,614 total)