Forum Replies Created

Viewing 15 posts - 1,486 through 1,500 (of 2,458 total)

  • RE: Usage of CTE - Trick with Dates

    Thomas Schutte (5/15/2015)


    In this case I would use a simple tally table:

    DECLARE @source TABLE (SegNo int, Date_Field smalldatetime, Month_Count int, Payment decimal(10,2))

    DECLARE @tally TABLE (N int)

    INSERT INTO @tally(N)

    SELECT ROW_NUMBER() OVER...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: PatExclude8K

    Thank you for the kind words Iwas

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Are the posted questions getting worse?

    GilaMonster (5/14/2015)


    Question for the people here...

    Over the years I've been very careful to keep my blog completely non-commercial, no adverts, no plugs for my company, nothing. Partially because when I...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: ghostscript to auto print a generated Reportservices Report

    Please don't cross-post.

    Original Post here: http://www.sqlservercentral.com/Forums/Topic1685618-3077-1.aspx

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Ghostscript to auto print reporting services report

    I'm curious - how is that script supposed to know what Report it's supposed to print?

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Need Help to sort alpha numeric values

    ORDER BY <column name>

    Add DESC at the end if you want to sort in descending order

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Import XML only gives Null results

    That's correct, XML is case sensitive.

    It's worth noting that you can improve you performance by adding a reference to the text node like so:

    SELECT CBAADO = x.data.value('(cbaado/text())[1]','varchar(3)'),

    ...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Column Store vs Row Store Indexes

    I just finished this article and learned a few things. Well done.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Day wise and date range calculation with looping or dynamic data

    See the link in my signature line for best practices on getting help then post DDL and sample data.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Need help with tuning a join query

    Prem-321257 (5/13/2015)


    Thanks for the tips!

    I changed the outer join to inner join and then using >= and <= operator instead of between. The execution time is now less then...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Change Query to only show 3 years of older dates

    I don't know which column is your datecol but something like this:

    WHERE <datecolumn> <= DATEADD(YEAR,-3,getdate())

    We would also have to determine exactly what you mean by "three years old" e.g. leap...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Slow Query

    GilaMonster (5/14/2015)


    Alan.B (5/14/2015)


    Add a the following WHERE clause to your Query after that and you get a non-clustered index seek (the plan has a slightly lower subtree cost on the...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Slow Query

    Why no PK and/or clustered index?

    Add a primary key to ID and you get a clustered index scan:

    CREATE TABLE dbo.tbl_Login_Details(ID INT IDENTITY, Session_SRNO INT, CONSTRAINT PK_Login PRIMARY KEY(ID));

    INSERT dbo.tbl_Login_Details

    SELECT...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Nested Procedure embedded in SSRS

    You are saying that you have a stored procedure with this code in it:

    EXEC PROC udp_TableUpdateALL (This calls 12 separate table updates)

    SELECT * FROM UpdatedTable?

    There is no reason that should...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Missing Column Statistics in tempdb

    Have you checked the data types? Some datatypes can't have statistics...

    From BOL:

    column [ ,…n]

    Specifies the key column or list of key columns to create the statistics on. You can...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

Viewing 15 posts - 1,486 through 1,500 (of 2,458 total)