Forum Replies Created

Viewing 15 posts - 1,951 through 1,965 (of 2,458 total)

  • RE: Need help with a SQL training question.

    DDL is always helpful for getting a good answer faster.

    Below is the DDL and solution to your problem. Note that some columns are not necessary; I included them so...

    "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: OLAP Knowledge

    I would start with The Microsoft Data Warehouse Toolkit: With SQL Server 2008 R2 and the Microsoft Business Intelligence Toolset.

    Though the book is based on the SQL Server 2008...

    "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 fix the used space of a database?

    ricardo_chicas (5/23/2014)


    HI

    I am using sql server 2008 r2 sp 10

    I have a database that originally consumed 500gb, I truncated most of the tables and now the biggest table consume around...

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

    Please include some DDL next to so as to get a faster response (note the link in my signature for getting help here).

    That said, I think this is 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: identifying different patterns

    mickyT (5/20/2014)


    Hi

    Here's another method using the same splitter and with the same conditions as Alan's. I though cube may give you the results you need

    declare @string varchar(500) = 'Carborator...

    "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 help needed

    Megha P (5/20/2014)


    Hi..Ed Pollack

    once again thanks..your code works correctly :-).

    meanwhile i come up with below code..just to share

    /* Data generation for #LocalTempTable */

    DECLARE @Date1 datetime

    DECLARE @Date2 datetime

    SET @Date2...

    "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: identifying different patterns

    Using the splitter function referenced in my signature you could do this.

    declare @string varchar(500) = 'Carborator Break Engine Oil';

    declare @tblPattern table (ID INT IDENTITY, Pattern VARCHAR(500), PatternIdentifier INT);

    ;WITH split1 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

  • RE: Update question on order of tables in join

    davoscollective (5/19/2014)


    Alan.B (5/18/2014)


    Your update query should be fine and, no, it does not matter if you include the table in the FROM or table operator clauses (e.g. JOIN & APPLY)....

    "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: Difference between two dates (Excluding Weekends)

    I did not address the weekend requirement but came up with something that will calculate days, hours and minutes. The only thing left to do is calclulate how much of...

    "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: Update question on order of tables in join

    Your update query should be fine and, no, it does not matter if you include the table in the FROM or table operator clauses (e.g. JOIN & APPLY).

    With 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: how to seperate the month and year from date?

    Taking it one step further...

    DECLARE @dt DATETIME;

    SET @dt = '2014-04-01';

    SELECT left(DATENAME(month,@dt),3)+'-'+ right(YEAR(@dt),2)

    "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 use Lag to avoid recursive CTEs?

    First, I do believe you can do this with using LAG. I don't have access to a 2012 instance at the moment; otherwise I could post an example.

    That said,...

    "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: Stairway to SQLCLR Level 2: Sample Stored Procedure and Function

    SQLRNNR (2/19/2014)


    Great article. Very useful information.

    One question I think could be answered and would be very useful to those noobs to CLR.

    How do you get the varbinary representation 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

  • RE: Stairway to SQLCLR Level 2: Sample Stored Procedure and Function

    5 stars! I just finished this and really enjoyed it. This is turning into a very excellent stairway Solomon and I can't wait to read the rest of the "levels"....

    "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: T-SQL Pivot Question

    Luis Cazares (2/7/2014)


    ...you're cheating with your test. You didn't clean up the buffer after the cross tabs and before the pivot. At least not in the code you posted. That...

    "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,951 through 1,965 (of 2,458 total)