Forum Replies Created

Viewing 15 posts - 421 through 435 (of 2,458 total)

  • RE: Query processing

    First, ditto everything Chris said.

    How does SQL Server handle casts in the WHERE clause?

    Not all that well. You are going to get an index scan instead of 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

  • RE: Syntax help please

    You could do this:

    WHERE CONVERT(DATE, Getdate())

    NOT BETWEEN TRY_CONVERT(monthbegindate, datetime) AND TRY_CONVERT(monthenddate, datetime)

    "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 use sp_msforeachdb to create multiple table in multiple databases

    drew.allen (10/4/2016)


    You have to be careful with sp_MSforeachdb, because it will also run in the system databases. I assume that you don't really want to create these tables in...

    "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 use sp_msforeachdb to create multiple table in multiple databases

    sp_msforeachdatabase is undocumented and overrated. That said, let's say you wanted to create a table named SomeTable in each db, you could do so like this:

    EXEC sp_msforeachdb

    '

    USE ?;

    IF...

    "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 get prevoius 4 hrs data

    Perhaps something like this:

    WHERE a.start_execution_date >= DATEADD(Hour,-4,getdate())

    Edit: that's a "greater than or equal" sign above, it keeps messed up when I post.

    "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 by number of characters

    drew.allen (10/3/2016)


    Alan.B (10/3/2016)


    We have a script for exactly this kind of thing; have a look at nsplit2B which you can find here[/url].

    Here's a couple examples:

    DECLARE @myv VARCHAR(MAX) = 'AB,CD,EF,GH,IJ';...

    "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 by number of characters

    Luis Cazares (10/3/2016)


    Hi Alan, you're still missing the GetNumsAB definition. I'd be interested on checking out how everything works. 🙂

    getnumsAB

    CREATE FUNCTION dbo.GetNumsAB

    (

    @low bigint,

    @high bigint,...

    "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 by number of characters

    We have a script for exactly this kind of thing; have a look at nsplit2B which you can find here[/url].

    Here's a couple examples:

    DECLARE @myv VARCHAR(MAX) = 'AB,CD,EF,GH,IJ';

    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: SSRS Print Button in Chrome Not Working (Browser Comaptibility)?

    Was this fixed in SSRS 2016?

    It appears to be but I have not tested it. In BOL, for SSRS versions 2014 and earlier, it explicitly says for Chrome, "Printing 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: Maximum number of CROSS APPLY functions

    ok, quick update. There does not seem to be a limit (I know you can do 2048 for sure).

    For fun, play around with this code:

    -- one time setup

    USE...

    "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: Maximum number of CROSS APPLY functions

    I was curious about this too and did a little research. There appears to be absolutely nothing about this out there about APPLY. Since APPLY is very similar to 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

  • RE: Today's Random Word!

    HappyGeek (9/30/2016)


    Eirikur Eiriksson (9/30/2016)


    Manic Star (9/30/2016)


    djj (9/30/2016)


    ChrisM@Work (9/30/2016)


    Kaye Cahs (9/30/2016)


    djj (9/29/2016)


    Grumpy DBA (9/29/2016)


    HappyGeek (9/29/2016)


    Coat

    Paint

    Brush

    Hair

    Today

    Tomorrow

    Evening

    Deadline

    target

    Costco

    "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: Execution Plan Help. Enormous Increase in row count in plan

    Is it possible that you could post the actual execution plan instead of the estimated plan? That will tell us much more. What you posted may not be the plan...

    "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: Splitting a multi-delimiter string and update

    I'm out of time but perhaps this can get you started. You can use DelimitedSplit8K_LEAD (see link in my signature) to parse the string like this:

    SELECT ItemNumber, item =...

    "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 become a BI professional without any Front End Development Skills?

    Can you really be an effective BI professional without C# [or front-end] development skills?

    YES.

    I've been a BI Developer/Architect/Consultant for ~7 years and I am a total .NET language novice. Front...

    "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 - 421 through 435 (of 2,458 total)