Viewing 15 posts - 781 through 795 (of 1,491 total)
amenjonathan (2/4/2011)
After a full or log backup, the transaction log will be emptied out, but the log size remains.
The log file is only emptied after a log backup.
So:
1. Schedule log...
February 4, 2011 at 10:00 am
Maybe:
;WITH AttemptOrder
AS
(
SELECT *
,ROW_NUMBER() OVER (PARTITION BY CODE, FAMILY, DEVICE, MANUFACTURER ORDER BY ATTEMPTS DESC) AS RowNum
FROM codes_table
)
DELETE AttemptOrder
WHERE RowNum > 1
February 3, 2011 at 8:55 am
I would test both solutions and see which is most efficient with your data.
February 3, 2011 at 3:31 am
Why bother with functions?:
DECLARE @starttime int = 80010
,@endtime int = 161500
SELECT ((@endtime/10000 * 60) + (@endtime%10000/100))
- ((@starttime/10000 * 60) + (@starttime%10000/100))
February 2, 2011 at 10:56 am
Just do another self join and sort it from there.
Something like the following:
DECLARE @DefaultMoisture float = 15.0
,@DefaultCu float = 2.0;
WITH ShiftTonnageMoistureCu
AS
(
SELECT S.[LogTime] AS ShiftTime
,S.Value AS WetTonnage
,COALESCE(AVG(M.Value), @DefaultMoisture) AS MoistureP
,COALESCE(AVG(C.Value), @DefaultCu)...
February 2, 2011 at 10:39 am
Maybe:
DECLARE @time int, @dt datetime;
SET @time = 80010;
SET @dt = DATEADD(second, 80010%100,DATEADD(minute, 80010%10000/100,DATEADD(hour, 80010/10000,'19000101')));
SELECT @dt
February 2, 2011 at 9:39 am
A CTE, except for the special case of recursion, behaves just like a non-persisted view that can only be used in the currect statement.
ie Just think of a CTE as...
January 31, 2011 at 6:47 am
A self join should work.
Something like:
-- *** Test Data ***
CREATE TABLE #t
(
[TimeStamp] datetime NOT NULL
,IDNumber int NOT NULL
,Value decimal(19, 2) NOT NULL
,Period varchar(2) NOT NULL
)
INSERT INTO #t
SELECT '20110115 07:00:00', 33080,...
January 31, 2011 at 5:38 am
Try something like:
SELECT *
FROM Client C
JOIN [Address] A
ON C.ClientID = A.Address_ClientID
LEFT JOIN
(
ITReturn R
JOIN
(
SELECT R1.ITR_ClientID, MAX(R1.AssesmentEndYear) AS AssesmentEndYear
FROM ITReturn R1
GROUP BY R1.ITR_ClientID
) D
ON R.ITR_ClientID = D.ITR_ClientID
AND R.AssesmentEndYear = D.AssesmentEndYear
)
ON C.ClientID =...
January 28, 2011 at 9:52 am
You could also have some problems with the data if you are not handling exceptions correctly.
(eg Attempting to put NULLs into a NOT NULL column etc)
You could try logging any...
January 28, 2011 at 5:59 am
I would be inclined to look at:
1. Just using union all for the default result set:
SELECT TOP (1)
{actual field list}
FROM {same as EXISTS statement}
WHERE {same as EXISTS statement}...
January 27, 2011 at 5:14 am
spidey73 (1/26/2011)
Server A: SQL 2008: contains the database on which the query is executed.
Server B: SQL 2005: the server from which the query is executed,
When I...
January 26, 2011 at 8:45 am
ntran777 (1/25/2011)
I need a proc that can make a variable number of temporary tables on the fly.
I would be interested in knowing why you need to do this. It...
January 26, 2011 at 8:16 am
To stop the race condition you will need to apply a key range lock on Jobs by making the select serializable.
(If this still gives problems add the update lock as...
January 24, 2011 at 7:31 am
Viewing 15 posts - 781 through 795 (of 1,491 total)