Viewing 15 posts - 781 through 795 (of 1,496 total)
I cannot remember if SQL2000 gave a specific exception if you tried to restore a backup produced by a more recent version of SQL server.
It may be worth finding out...
February 15, 2011 at 8:27 am
As sometimes excessive data validation can cause users not to enter anything, another approach is to produce regular data quality reports grouped by department, user etc.
If management want information based...
February 15, 2011 at 6:04 am
The following will order the compsite alphabetically but it will have an unique value:
;WITH Composites
AS
(
SELECT A.ColA, A.ColB
, STUFF(
(SELECT ' ' + CAST(B.ColC as varchar(255)) + ','
FROM YourTable B
...
February 10, 2011 at 8:57 am
In Theory, it makes no difference what you SELECT in an EXISTS sub-query as it is just syntactical sugar. (ie Nothing is actually selected.)
I seem to remember someone doing a...
February 10, 2011 at 4:48 am
You need to give the columns in a derived table a name so do something like:
SELECT COUNT(*)
FROM
(
SELECT UPPER(s_name) AS s_name
FROM bmi_tr
) dual;
or:
SELECT COUNT(*)
FROM
(
SELECT UPPER(s_name)
FROM bmi_tr
) dual (s_name)
Of course, you will...
February 7, 2011 at 9:35 am
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
Viewing 15 posts - 781 through 795 (of 1,496 total)