Forum Replies Created

Viewing 15 posts - 6,451 through 6,465 (of 7,425 total)

  • RE: Performance tuning

    Very little to go on ... but here's my best guess so far:

    IF EXISTS(SELECT 1 FROM sys.objects WHERE name = 'FACT_SalesAnalysis')

    DROP TABLE FACT_SalesAnalysis

    -- ...

  • RE: Average hourly rowcounts

    SELECT

    DATEADD(HOUR, DATEDIFF(HOUR, 0, RunDateTime), 0) AS AvgHourlyDateTime,

    --DATEADD(MILLISECOND, -3, DATEADD(HOUR, DATEDIFF(HOUR, 0, RunDateTime) + 1, 0)) AS AvgHourlyEndDateTime,

    AVG([RowCount]) AS...

  • RE: SQL Server Logon Trigger Problems

    It looks to me like you're checking all connections to the database. If there are many such connections for different users, that could be a drag on the trigger.

    So,...

  • RE: Performance Problem

    Would need to also at least see the DDL ("CREATE TABLE"/"CREATE INDEX") for the tables, including all indexes.

  • RE: script

    You can use COALESCE(): for only 4 values, it's actually clearer to me personally (ymmv) than the other method.

    SELECT

    t.id,

    COALESCE(t.field1, t.field2, t.field3, t.field4)...

  • RE: How to interprete the unused space ?

    Lynn Pettis (3/20/2013)


    You do realize that shrinking a database will fragment the indexes used by the queries run to generate the reports and that this will impact the performance of...

  • RE: Rebuilt Index

    FYI, a FILLFACTOR of 80 is wasting space in many tables and perhaps even still have too little freespace in others.

    You need to determine the best FILLFACTOR for each table...

  • RE: Ranking functions, views, and predicates

    Since the best plan will vary based on the selectivity of the specific @BatchID passed in, try it with the RECOMPILE option:

    SELECT *

    FROM <myDatabase>.<mySchema>.vw_BatchItems

    WHERE BatchID = @BatchID

    OPTION ( RECOMPILE );

  • RE: sys.dm_io_virtual_file_stats - Number of Read and Writes

    No, that's not how those counters work.

    A single SELECT statement can, and very often will, generate multiple physical reads.

    A single UPDATE or DELETE statement can, and very often will, generate...

  • RE: case statement in count?

    SELECT

    '20130701' AS Date, Year,

    6 AS JulyMaxhours,

    SUM(6) AS Total_Hours,

    KindOfDay, Month

    FROM Auxiliary.Calendar

    WHERE (KindOfDay =...

  • RE: Combining Two Very Large Tables

    It's easy enough to generate the code for 00 to 99 based on the pattern for 00, so it's not really "manual" coding.

    I figured on a (very broad) average of...

  • RE: case statement in count?

    Not sure I fully understand, but maybe:

    SELECT Date, Year, CASE DATEPART(mm, date) WHEN 07 THEN 6 END AS JulyMaxhours, KindOfDay, Month,

    SUM(CASE WHEN DATEPART(mm, date) = 07 THEN 6 ELSE 0...

  • RE: how to make a stored procedure return a value when there are no available values

    CREATE PROCEDURE [dbo].[GetExtractSiteExtractFileBatchPreviousSuccessInd]

    @BatchStatusCd NVARCHAR(5)

    ,@ExtractSiteCd NVARCHAR(10)

    ,@ExtractAsOfDate DATETIME

    AS

    RETURN (

    SELECT CASE

    ...

  • RE: Combining Two Very Large Tables

    Maybe consider records to "match" if the SSN, first name and birth date all match. My reasoning: last name can change (marriage, etc.), and middle name may not be...

  • RE: SP execution time.

    Or, depending on your specific needs, you could add your own logging/pseudotrace code to the proc itself, and trigger it with an optional parameter:

    CREATE PROCEDURE dbo.proc_name

    @...,

    ...

Viewing 15 posts - 6,451 through 6,465 (of 7,425 total)