Forum Replies Created

Viewing 15 posts - 1,681 through 1,695 (of 2,462 total)

  • RE: T-SQL Pivot

    Had a few moments to kill...

    USE tempdb

    GO

    -- It's always good to provide sample data in an easily usable format like so

    CREATE TABLE dbo.

    ([year] int not null,

    Client_Name varchar(100) not...

    "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: What would Fill Factor Do?

    PHYData DBA (3/24/2015)


    Alan.B (3/23/2015)


    My apologies - I misread you original post a little. I was under the impression that some of these indexes were 10% fragmented weekly, not more than...

    "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: Help with query

    SELECT * FROM

    (

    SELECT LocationID, LanguageID ,LocationLanguageRecID,

    row_number() over (partition by LOCATIONID

    order by LocationLanguageRecID) LineNumber

    FROM LocationLanguages

    ) X

    WHERE LineNumber = 2

    "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: Help with finding multiple Character Occurence in String

    Luis Cazares (3/24/2015)


    Alan.B (3/24/2015)


    Luis Cazares (3/24/2015)


    This is a quick idea.

    WITH Letters AS(

    SELECT TOP 26 CHAR(ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) + 64) letter

    FROM...

    "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: sp_MSForEachDB

    I reject any code using either sp_MSforeachdb or sp_MSforeach_worker as these do not meet the standards I'm enforcing,

    +1

    "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: Help with finding multiple Character Occurence in String

    Luis Cazares (3/24/2015)


    This is a quick idea.

    WITH Letters AS(

    SELECT TOP 26 CHAR(ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) + 64) letter

    FROM sys.all_columns

    )

    SELECT DISTINCT n.*...

    "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: faster in SSMS slower in proc

    SQL_Surfer (3/24/2015)


    If I embed the sql inside a proc, it takes over an hour but if i just run as is, it executes in less than 10 seconds. I don't...

    "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: Performance Tuning Questions

    I used to use the DTA back some years back but, for me, have gotten more bang for my buck by running DMV queries to find my longest running queries...

    "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: Drop Unused indexes?

    ZZartin (3/24/2015)


    Based on what you have posted, these indexes are not helping you in any way. Indexes speed up reads and slow down modifications. In other words an index, when...

    "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: Drop Unused indexes?

    MadAdmin (3/24/2015)


    19 indexes? Epic!

    In addition to TheSqlGuru's great advice,

    before you drop indexes, take note that there are some heroes who do silly things like drop and create indexes in SSIS...

    "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: Drop Unused indexes?

    ... and since this is such an important topic I thought I'd do quick test to demonstrate.

    For the first test we'll INSERT 500,000 rows into a table without an...

    "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: Drop Unused indexes?

    Sapen (3/24/2015)


    Alan.B (3/23/2015)


    Although the user seeks, user scans and userlookups are all 0 the user updates is definitely a lot. I am thinking to speed up updates on subscriber these...

    "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: Want to return character(s) after a dash (-)

    I used a temp variable in my solution below for sample data so that you can just run this in SSMS. The SELECT statement is what you're looking for.

    DECLARE...

    "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: Converting query output to HTML Format

    The problem is that the @TABLE_STYLE variable is a fed to an inline style which means the style can't include style tags. E.g. "style = {Font-family: arial; color: red}"

    A style...

    "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: What would Fill Factor Do?

    My apologies - I misread you original post a little. I was under the impression that some of these indexes were 10% fragmented weekly, not more than 10% as you...

    "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,681 through 1,695 (of 2,462 total)