Forum Replies Created

Viewing 15 posts - 781 through 795 (of 1,491 total)

  • RE: Backup: My logfile is very large!

    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...

  • RE: Delete Duplicate Records

    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

  • RE: Query Help - Denormalising Perhaps ?

    I would test both solutions and see which is most efficient with your data.

  • RE: How to convert integer to hours,mins and seconds

    Why bother with functions?:

    DECLARE @starttime int = 80010

    ,@endtime int = 161500

    SELECT ((@endtime/10000 * 60) + (@endtime%10000/100))

    - ((@starttime/10000 * 60) + (@starttime%10000/100))

  • RE: Query Help - Denormalising Perhaps ?

    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)...

  • RE: How to convert integer to hours,mins and seconds

    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

  • RE: Query Help - Denormalising Perhaps ?

    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...

  • RE: Query Help - Denormalising Perhaps ?

    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,...

  • RE: Help On Query

    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 =...

  • RE: problem with trigger

    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...

  • RE: Return most recent result or a default

    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}...

  • RE: Query in Sql 2000

    Google Number/Tally table.

  • RE: PREEMPTIVE_OLEDBOPS cause of slow down remote query

    spidey73 (1/26/2011)


    I've got two machines:

    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...

  • RE: Dynamic SQL with Temp Tables

    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...

  • RE: Can I add an explicit lock to hold a record?

    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...

Viewing 15 posts - 781 through 795 (of 1,491 total)