Forum Replies Created

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

  • Reply To: Advanced T-SQL: Replacing Slow Cursors with Window Functions

    Second time posting this - the first time I included more than one link, which prevents your post from being published.

    Great article. I wish there were more articles like this.

    Let...

    "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

  • Reply To: Test topic for spam filtering

    The problem is when we include more than one link the message just doesn't get posted and you can't retrieve your post. It's infuriating and explains why "SSC Gurus", such...

    "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

  • Reply To: Advanced T-SQL: Replacing Slow Cursors with Window Functions

    "But, sometimes a cursor is actually the simplest approach if it can be performant."

    Respectfully - I'm struggling to think of an example of where a cursor is the "simplest approach",...

    "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

  • Reply To: Test topic for spam filtering

    I'll do a test post too.

    https://substack.com/home/post/p-185215444

    "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

  • Reply To: Learning a New Language

    I've been late to the AI party. Everyone I work with uses Copilot, I just starting playing with it - I don't have an opinion yet.

    I love Grok, it has...

    "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

  • Reply To: From each string, extract numbers following a '#' and create separate row

    Jeff Moden wrote:

    Alan... you might want to explain what the bernieML.samd. stuff is.

    Thanks Jeff - I fixed my code. I was using my own DB and forgot to remove 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

  • Reply To: From each string, extract numbers following a '#' and create separate row

    UPDATED 10/31/2024

    The was an error in my code, I just changed  "bernieML.samd.ngrams8K" to "dbo.ngrams8K". I was using code from my own DB (BernieML) with a different schema (samd).


    @sqlrookie-2

    Sorry for...

    "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

  • Reply To: Data cleansing/conversion tool HPE

    There's always MS Data Quality Services (DQS). It allows for data cleansing, matching, de-duplication and an array of related data quality services. It's not easy to use but does...

    "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

  • Reply To: From each string, extract numbers following a '#' and create separate row

    For this you can use a "splitter" (AKA "tokenizer" function.)

    DECLARE @String VARCHAR(8000) = 'Hello world. #1234 has been replaced by #014521';

    SELECT SomeNbr = REPLACE(split.[value],'#','')
    FROM STRING_SPLIT(@String,' ') 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

  • Reply To: From each string, extract numbers following a '#' and create separate row

    Post got submitted twice. Sorry.

    • This reply was modified 1 years, 9 months ago by Alan Burstein. Reason: Dupe
    "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

  • Reply To: T-SQL Requires the Right Approach

    Another problem I’ve seen frequently is the overuse of user-defined functions (UDFs), especially nesting scalar UDFs.

    scalar UDFs, nested or not, tend to burn the house down.  When used in a...

    "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

  • Reply To: How To Find A Perfect Match

    Glen - I love this article. Amazing stuff. I read some of it and skimmed the rest but can't wait until I have time to play with your code a...

    "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

  • Reply To: "Number of rows Read" vs "Actual Number of rows for all Executions"

    Thanks for the replies and sorry for being a Ghost OP.

    To me, the above makes sense based on the wording of those metrics and is useful information.  Does the above...

    "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

  • Reply To: How to update generated number field with number to every group from 1 to 4 ?

    Adi did it like I would. His excellent solution could be simplified as

    SELECT t.FamilyID, t.PortionKey, t.GroupID, GeneratorNumber = 
    ...
    "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

  • Reply To: Need help in rewriting this query to improve performance

    I would write it using EXISTS instead of INs. It's easier if you use table aliases.

    I always use EXISTS instead of IN. Best case - it performs better, worse case...

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