Forum Replies Created

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

  • RE: Avoid Blank Values in a column

    Ed Wagner (3/11/2016)


    Alan, I stand corrected. I've never seen it done this way. I learned something new, so thank you.

    Sorry for the late reply Ed (I was away...

    "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?

    Jack Corbett (3/21/2016)


    Alan.B (3/21/2016)


    Quick question: I got the standard email saying that someone replied to a comment on one of the forum threads but when I go to...

    "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?

    Quick question: I got the standard email saying that someone replied to a comment on one of the forum threads but when I go to that thread the comment is...

    "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 a String in a String

    quagmired (3/20/2016)


    This is exactly what I'm talking about when I mention "cumbersome TSQL solution". For arbitrary 0s, I'd say a tally table would have to have over 2 billion records,...

    "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 a String in a String

    quagmired (3/17/2016)


    Jeff Moden (3/17/2016)


    quagmired (3/17/2016)


    My personal favorite is, given the same accuracy, which ever is the fastest and least resource intensive. That's usually not REGEX as called from SQL...

    "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 a String in a String

    Steve Jones - SSC Editor (3/10/2016)


    PATINDEX is powerful, without a doubt. I have more of a fondness for charindex, mostly because I can indicate a start position. However, as Luis...

    "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: Avoid Blank Values in a column

    IF OBJECT_ID('tempdb..#yourtable') IS NOT NULL DROP TABLE #yourtable;

    CREATE TABLE #yourtable

    (

    c1 varchar(10) NOT NULL,

    c2 varchar(10) NOT NULL,

    c3 varchar(10) NOT NULL,

    c4...

    "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: Avoid Blank Values in a column

    You'll need to add a CHECK Constraint. The code will look like:

    ALTER TABLE <yourtable>

    ADD CONSTRAINT ck_constraintname

    CHECK (column <> '')

    "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: LIKE with 2 searches

    Try

    WHERE Item LIKE '%S' OR Item LIKE '%B'

    "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: SQL - The conversion of a varchar data type to a datetime data type resulted in an out-of-range value

    Tell us what you're trying to do and I but someone can come up with a solution which that requires less code and performs much better. All that CASTing 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: Find a String in a String

    Good article Steve. I think you under sold the power of PATINDEX...

    CHARINDEX can start at a certain position in the string while PATINDEX can take wildcards. In this simplistic 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

  • RE: Career Advice, Oracle or SQL Server?

    There's advantages to mastering Microsoft and advantages to diversifying your skill set. The great thing is that data is hot so, as long as your skills are growing, your career...

    "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: Split string into multiple entries based upon known static length

    mciesiensky (3/8/2016)


    Sorry. Took me a minute to see the "t.n" in the code. Added that to my output and I think that will work.

    Now to convert that to...

    "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: Can you create an index that has an expression ?

    You can also create an indexed view.

    "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: Trust, or Verify – How FKs Can (or Cannot) Help Performance

    Really great work Hugo.

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