Forum Replies Created

Viewing 15 posts - 256 through 270 (of 2,458 total)

  • RE: SQL Query on Start & End Dates

    I did this on my phone and cant test this but i think this is what you need.

    With yourData (rn, Emp_ID, Hour_Type, Start_Date, Hours, End_Date
    AS
    (
    ...

    "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: t-sql 2012 parse out multiple values in one field that is varchar(1200)

    First for some sample data

    USE tempdb
    GO

    IF OBJECT_ID('tempdb.dbo.cannedPhrases') IS NOT NULL DROP TABLE dbo.CannedPhrases;
    IF OBJECT_ID('tempdb.dbo.GS') IS NOT NULL DROP TABLE dbo.GS;
    GO

    "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: Heap vs Clustered Wildcard Search

    Joe Celko
    Please read a book on RDBMS. The identity column is not a column! It's a table property imposed by physical storage...


    This statement is 100% untrue. 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: How to create data with numeric ranges

    Ed Wagner - Tuesday, May 16, 2017 1:49 PM

    Alan, that's a cool ITVF.  I've used a similar approach when generating test 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: Performance issue with EXCEPT

    Without Execution plans (you can just post them here, BTW, using the "Add File" link below) it's impossible to determine why each query is performing differently. In SQL server 2014...

    "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: How to create data with numeric ranges

    I posted this function about a year ago here. It takes for parameters:
    @low  = represents the lowest value for n1.
    @high = represents the highest...

    "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: Best practice

    cbrammer1219 - Wednesday, May 10, 2017 1:47 PM

    I am wanting to do this with the least hands on as possible, I have...

    "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: Best practice

    Yes, SSIS is the best tool for this. 

    Depending on your SSIS skill level , you can also use the SQL Server Import/Export wizard (which uses SSIS). You would...

    "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: SSIS Data Flow vs SQL Stored Procedure Loop

    When moving need to perform insert/update based on primary key value.


    This sounds like a job for MERGE to me; there's no need for a loop...

    "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: Find highest number in a column of strings

    Well, if you have to use a function to strip the non-numeric characters then DigitsOnlyEE is the best way to go (something I was going to say until...

    "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: Case Expresion Then Containing String of Text and attribute result?

    If Serv.ID is numeric then you would have to convert it to a string first:
     Then 'Assessment' + ' - ' + CAST(Serv.ID AS varchar(10))
    Or, my favorite, CONCAT:

    "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: Why does Microsoft recommend THROW over RAISERROR?

    A general observation is that the overal quality and consistency of Microsoft online documentation is declining. I digress.

    Raiserror has been on the chopping block for some time and...

    "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: Case Expresion Then Containing String of Text and attribute result?

    elzool - Thursday, May 4, 2017 4:33 PM

    I've a case expression that I'd like to look like this, but this isn't working.
    I'm...

    "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 Using Extended Events: Part 3

    I love this series Brian, its very informative. Well done, 5 stars!

    "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: Date Dimension Script

    Well done. It's always nice to see a RBAR-free, set-based approach to building tables like this. A few things I would change to improve performance:

    1. Make all 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

Viewing 15 posts - 256 through 270 (of 2,458 total)