Forum Replies Created

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

  • RE: String Together Mulitple fields when not NULL

    This will get you there except when the first or last fields are NULL. I'll let you figure that out or perhaps someone else will jump in to seal 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: Specialist or Generalist

    Great Editorial Steve!

    "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: Counting

    mailtoashokberwal (4/25/2016)


    Thanks 🙂

    I tried another approach with CTE and that works fine too.

    WITH cte(a)

    AS

    (

    SELECT 1

    UNION ALL

    SELECT a+1 FROM cte WHERE a<10000

    )

    SELECT * FROM cte OPTION(MAXRECURSION 10000)

    That's going...

    "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: Pivot rows into columns

    No need to use Pivot at all. Here's Robert's sample data in a temp table (using a temp table so I can show you how to index correctly for my...

    "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: FK and Index

    I would take a look at this book: Performance Tuning With SQL Server Dynamic Management Views. It will help you put together scripts you can use to determine which FK...

    "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: Recording data in an .xml file to SQL server for tracking

    I would add:

    You'll want to learn first how to import the XML data which should be pretty easy. Then how to save it as relational data - meaning that it's...

    "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: Reaping the benefits of the Window functions in T-SQL

    Eirikur Eiriksson (4/22/2016)


    Alan.B (4/22/2016)


    Nice to see this article again. Still awesome!:-P

    Thanks Alan! When are you going to do a piece about your interesting work?

    😎

    Very soon sir, I have a few...

    "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: Reaping the benefits of the Window functions in T-SQL

    Nice to see this article again. Still awesome!:-P

    "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: Mondays and Sundays of the month

    You can get rid of this statement:

    drop table #tmp_datesforMonthAM

    "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: Recording data in an .xml file to SQL server for tracking

    First, welcome to SQLServerCentral. This sounds like fun.

    What you want to do sounds simple and easy. A few questions:

    1. Do you have an MS SQL Server you can 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: More TRY_CONVERTing numbers

    I said 2. What is wrong with me.

    "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: stored procedure parameter issue

    John Rowan (4/21/2016)


    This is a pretty simple task if I'm reading your requirements correctly. Before we all do the work for you, can you show us what you've tried...

    "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: Building BI from Scratch!

    singhamitpal (4/20/2016)


    Thanks everyone for your responses, my intentions was not to offend anyone here. Just needed a direction in picking the right path. Thanks for sharing your knowledge &...

    "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: Max value in Case Statements

    Con Alexis (4/20/2016)


    I'd probably use a CROSS APPLY in this instance...

    e.g.

    WITH Data AS

    (

    SELECT 1 AS ID, '1/1/1900' AS Date

    UNION ALL SELECT 2, '1/1/1900'

    UNION ALL SELECT 3, getdate()

    UNION ALL SELECT 4,...

    "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: Max value in Case Statements

    drew.allen (4/20/2016)


    Is there some reason that you chose to use CROSS APPLY rather than CROSS JOIN? I tend to only use CROSS APPLY if the right side is somehow...

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