Forum Replies Created

Viewing 15 posts - 16 through 30 (of 55 total)

  • RE: How can I track how many times a specific SP is called every day?

    The following DMV query returns the number of execution for a specific stored procedure since the last server restart:

    SELECT execution_count

    FROM sys.dm_exec_procedure_stats

    WHERE object_id = OBJECT_ID('YourSPNameGoesHere')

    If your server is online more than...

  • RE: Ideal table for Memory Optimization ?

    Koen Verbeeck (4/3/2014)


    GilaMonster (4/3/2014)


    [

    Why would you do that over making them DURABILITY = SCHEMA_AND_DATA?

    I doubt they're the target of heavy changes, so there won't be logging overhead.

    Good point.

    Yep. Whenever you...

  • RE: Ideal table for Memory Optimization ?

    As with disk tables we would need your CREATE TABLE statement for the memory optimized table to check the table and index definition.

    Since the ALTER TABLE statement is not...

  • RE: Dates in different languages

    DECLARE @d AS DATE = '20140101';

    INSERT INTO dateLanguage([monthName],monthNameEs,monthNameFr,MonthNamePt)

    SELECT

    FORMAT(@d, N'MMMM', N'en-us'),

    FORMAT(@d, N'MMMM', N'es-es'),

    FORMAT(@d, N'MMMM', N'fr-fr'),

    FORMAT(@d, N'MMMM', N'pt-pt');

    GO

    SELECT * FROM dateLanguage;

    [font="Courier New"]monthName ...

  • RE: Sorting based on last 12 months.

    Create and populate sample table:

    CREATE TABLE dbo.T1

    (

    m TINYINT NOT NULL,

    val INT NOT NULL

    )

    GO

    INSERT INTO dbo.T1

    VALUES(1,2019),(2,2941),(3,2968),(4,1523),(5,1983),(6,2398),

    (7,2347),(8,1348),(9,2772),(10,2289),(11,1765),(12,1256)

    GO

    Here is the query:

    SELECT *

    FROM dbo.T1

    ORDER BY CASE WHEN m < MONTH(GETDATE()) THEN...

  • RE: Create index question

    Your create index statement fails because of syntax error.

    This part:

    WITH (FillFactor = 100)

    WITH DROP_EXISTING

    needs to be rewritten to:

    WITH

    (

    FILLFACTOR = 100,

    DROP_EXISTING = ON

    )

    With so corrected syntax your statement still can...

  • RE: Is View Cached somewhere in SQL Server 2008 R2

    Do you use fully qualified names? i.e. SELECT cols FROM dbo.Table1 instead of SELECT cols FROM Table1?

  • RE: Steps to tune a specific query

    Hi,

    I would have similar observation as Luis and would concentrate on the requirements and constraints. Your task is to tune a bad performed query written by someone else. Your constraints...

  • RE: Execution Plan

    You cannot say in advance if Key Lookup is good or bad. If your query needs to return several columns you cannot avoid it (or you can if you scan...

  • RE: Custom sort order within each group of the result set

    Hi again,

    You can use the statement provided by Scott, too to avoid usage of UNION ALL:

    SELECT *,

    ROW_NUMBER() OVER(PARTITION BY OrderID

    ORDER BY CASE WHEN ItemTypeID = '4006' THEN...

  • RE: Starting sql 2014 are ntext, text and image data types being deprecated?

    These data types are deprecated since the version SQL Server 2008. It seems that Microsoft still has customers using these old data types in actual workload and therefore they support...

  • RE: Custom sort order within each group of the result set

    I hope that I interpreted well your requirements:

    SELECT *, 1 AS ItemSortOrder

    FROM @ItemList

    WHERE ItemTypeID = 4006

    UNION ALL

    SELECT *,

    (1 + ROW_NUMBER() OVER(PARTITION BY OrderID ORDER BY ItemID)) AS ItemSortOrder...

  • RE: retrieve last date for item from two tables?

    SELECT t1.address, t1.temperature, t1.last_update, app2.temperature temperature_t2, app2.last_update last_update_t2

    FROM table1 t1

    OUTER APPLY

    (

    SELECT TOP 1 t2.Address,t2.last_update FROM TABLE2 t2 WHERE t1.Address=t1.Address ORDER BY...

  • RE: sp_executesql: why does plan only use index seek with OPTION(RECOMPILE)

    Igor,

    An index seek in your second example has been chosen by the optimizer because the query is not parametrized. You simply concatenated the query text and the resolution about the...

  • RE: Stored Procedure Boundaries

    dj341 (2/26/2014)


    robert.diley (2/26/2014)


    How odd. I actually tried running this (copy/pasted the code) and got the following:

    (1 row(s) affected)

    Msg 8134, Level 16, State 1, Procedure TestProc, Line 6

    Divide by zero error...

Viewing 15 posts - 16 through 30 (of 55 total)