Forum Replies Created

Viewing 15 posts - 616 through 630 (of 2,458 total)

  • RE: TSQL Select specific records and child records from same table

    SELECT

    p.ProjectNo,

    ProjectType = CASE WHEN p.ProjectType = 'new' AND x.ProjectType IS NOT NULL THEN 'new' ELSE '' END,

    p.Location,

    ChildDef = ISNULL(ChildDef,'')

    FROM dbo.projects p

    LEFT...

    "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: TSQL Select specific records and child records from same table

    Or this:

    SELECT *

    FROM dbo.projects

    WHERE Location IN

    (

    SELECT Location

    FROM dbo.projects

    WHERE ProjectType = 'new'

    )

    "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 Calendar Table based on Start and End Date Help

    DiabloSlayer (6/26/2016)


    Hi Alan Burstein,

    ...Secondly, can you point me where I can learn the contents in your script so I can decipher it and learn it for the future?

    Ok, my final...

    "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 Calendar Table based on Start and End Date Help

    Sergiy (6/30/2016)


    Wow!

    That's a big bunch of code!

    Compare to this (using the table I've posted above):

    DECLARE @StartDate SMALLDATETIME, @EndDate DATE, @WeekStartsFrom VARCHAR(50)

    SET @StartDate = '20160501'

    SET @ENDDATE = '20160531'

    SET @WeekStartsFrom =...

    "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 Calendar Table based on Start and End Date Help

    DiabloSlayer (6/30/2016)


    Hi Alan,

    Thank you for the update and help !!

    So I ran the update script for the period of 05/01/2016 to 05/31/2016 and I'm not sure why I'm getting two...

    "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 with 3 parameters as delimited list - Goal 500 milliseconds

    TheSQLGuru (6/30/2016)


    Alan.B (6/30/2016)


    Kevin said a lot of what I was going to say especially about fixing that sort with the tempdb spill - that's going to kill you. An index...

    "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 with 3 parameters as delimited list - Goal 500 milliseconds

    Kevin said a lot of what I was going to say especially about fixing that sort with the tempdb spill - that's going to kill you. An index on [WOEC].[WOE].[ORDER_ITEM].ORDER_ITEM_UID,...

    "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 Calendar Table based on Start and End Date Help

    DiabloSlayer (6/26/2016)


    Hi Alan Burstein,

    I ended up using your solution so thank you VERY MUCH 🙂

    I just have two questions for you, first, how can I change the start date 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: What is this WHERE clause

    Luis Cazares (6/29/2016)


    oradbguru (6/29/2016)


    Hello, I was debugging some legacy code and came across an insert statement with only this in the where clause.

    WHERE ' ' = ' '

    Any ideas what...

    "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 Agent missing in SSMS

    Forgive me if I'm wrong (it's been many years since I was a DBA) but I believe they would also need at least public access to the msdb database.

    "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: Simple CLR request

    Solomon Rutzky (6/26/2016)


    Hey Alan. Interesting request. I do have a suggestion for the code, but first I would like to mention that it is probably best to state at 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

  • RE: Nasty Fast N-Grams (Part 1): Character-Level Unigrams

    johnmackintosh (6/23/2016)


    Thanks for this, highly informative post.

    I had no idea this was possible in SQL Server.

    I've done some text mining work using n-grams using R, but I imagine it will...

    "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: Reporting Services - Passing Parm String to Stored Procedure ?

    Smendle (6/27/2016)


    Alan.B (6/24/2016)


    If it's a multi-select then SSRS passes the SSRS parameter values as a comma delimited string.

    If user selects CA then 'CA' is passed to the stored proc....

    "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: query performance tuning

    You'll need to post the DDL for the tables you are querying for a better answer. Im not at a SQL Server so I can't look at the execution 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: Reporting Services - Passing Parm String to Stored Procedure ?

    If it's a multi-select then SSRS passes the SSRS parameter values as a comma delimited string.

    If user selects CA then 'CA' is passed to the stored proc. If 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 - 616 through 630 (of 2,458 total)