Viewing 15 posts - 5,341 through 5,355 (of 7,597 total)
Insert Into @OFBDATA
(ShiftStartdate,
ProdShiftcolor,
Line,
DieNo,
Goodparts,
ScrapParts)
Select
scrapdata.Rundate,ScrapData.ProdShiftcolor,ScrapData.Line,ScrapData.DieNo,
case when which_row = 'F' then scrapdata.[Good parts F ] else scrapdata.[Good parts R ] END,
case when which_row = 'F'...
February 26, 2015 at 1:55 pm
Either cluster directly on the string itself. Or, if you don't want to do, encode the string into an int (or smallint if you have less than ~20,000 values)...
February 26, 2015 at 1:25 pm
I think something roughly like this:
(SELECT COUNT(DISTINCT daysworked) AS 'Days Worked'
FROM (SELECT CAST(DATEPART(MM, DATEADD(HOUR, -8, ActualEnd)) AS VARCHAR) + '/' + CAST(DATEPART(DD, DATEADD(HOUR, -8, ActualEnd)) AS VARCHAR) + '/'...
February 26, 2015 at 1:20 pm
That's interesting. I didn't realize SQL would convert that. Not sure exactly the optimizer knows when it's "safe" to do that.
February 25, 2015 at 12:50 pm
mbhandari (2/25/2015)Thanks for your invaluable comments. I looked at the execution plans for IF( SELECT COUNT(*)... ) and IF EXISTS options and its giving me identical plan. But I am...
February 25, 2015 at 12:27 pm
All true. However, you can improve the coding of the second query:
Instead of:
IF
(
SELECTCOUNT(*)
FROMMY_CODE
) > 0 </frame>
Use:
IF EXISTS(SELECT TOP (1) 1 FROM MY_CODE)
You're having...
February 24, 2015 at 2:28 pm
It is described in BOL. Under "ALTER TABLE", "table constraints". Notice that the text "[CONSTRAINT constraint_name]" is optional, followed by the required "DEFAULT constant_expression FOR column". Viz:
ALTER...
February 23, 2015 at 4:04 pm
Assuming you don't have a "TimeGroup" (as calc'd below) of 0, maybe this code will give you the exact result you want:
SELECT
Time_Min * 100 AS Time_Min,
...
February 23, 2015 at 3:58 pm
No; in fact, you should not do that. The rebuild will use full statistics from the entire table, whereas updating the stats would just use a sampling of rows....
February 19, 2015 at 2:41 pm
Hmm, the way I read it, you have only two physical processors, therefore MAXDOP should not exceed two.
February 18, 2015 at 11:58 am
smitty-1088185 (2/15/2015)
Eirikur Eiriksson (2/14/2015)
😎
SELECT
OBJECT_NAME(SD.object_id) AS OBJ_NAME
,OBJECT_NAME(SD.referenced_major_id) AS DEPENDENT_NAME
...
February 17, 2015 at 2:13 pm
I assumed backups were going to a different drive.
But the backup only gets you to the last backup time. To recover forward to the current time, you need either:...
February 17, 2015 at 1:54 pm
INSERT INTO dbo.LiveTable
(Information, MachineId, StatusId)
SELECT s.Information,
(SELECT m.MachineId
FROM dbo.Machine m
WHERE
...
February 17, 2015 at 1:50 pm
Ideally you want to be able to recover the db if either drive fails, or is completely destroyed even.
Currently only "A" gives you that.
In theory "B" might work, if every...
February 17, 2015 at 1:05 pm
There is no such thing as an accurate, global freespace percentage. Freespace needs to be set index by index. Thus, a generic rebuild should never specify a fillfactor,...
February 17, 2015 at 8:31 am
Viewing 15 posts - 5,341 through 5,355 (of 7,597 total)