Forum Replies Created

Viewing 15 posts - 436 through 450 (of 2,458 total)

  • RE: SQL Server 2014 Developer edition

    I, too, had a real hard time with this, it took me a long time to find where/how to download Dev Edition. I remember that that key was to be...

    "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: Daily working Hours

    Provided you can get away with up to 2 clock_in's and clock_out's per person/date you can do this:

    WITH Prep AS

    (

    SELECT

    creation_date = CAST(creation_date...

    "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: Daily working Hours

    This should not be hard, I'm looking at this now.

    In the meantime, in case people want easily consumable sample data...

    SELECT * INTO dbo.test

    FROM

    (

    VALUES ('168780','10148','16477','7/21/2016 15:00','CLOCK_OUT','1','DAY','RICHAR'),

    ...

    "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: Adding Windows Function causes very bad performance (help plz!)

    Eirikur beat me to it on the POC index - that's always the first thing I look for when a window function makes a query much slower.

    I would add...

    "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: make over columns using comma seperated and select in query

    What you are doing does not make much sense. Perhaps you could post some sample data and your desired results and we can point you in the right direction.

    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: The Christmas CROSS APPLY

    Yay. I got one right.

    Personally I'd simplify this one like this:

    SELECT

    DATEADD(YEAR, N, CONVERT(DATE, v.HolidayDate)) AS HolidayDate,

    HolidayName

    FROM (VALUES ('12/25/2016', 'Christmas Day')) AS v (HolidayDate, HolidayName)

    CROSS...

    "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: Dynamically creating a @table Table from a current table

    Lynn Pettis (9/27/2016)


    mister.magoo (9/27/2016)


    Lee Hopkins (9/27/2016)


    I have a script that gives me a string of the columns and types.

    I wan to use this result to create a declared table

    DECLARE @listStr...

    "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 Upgrade T-SQL Skills

    A lot of good advice here, especially

    The best way to get better at writing T-SQL is to write a lot of T-SQL.

    Over the years I have created dozens 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: PLEASE HELP ****** Stripping #s from one column to update 2 columns *******

    I have no idea what you're trying to do but it seams simple. Please post your desired results. On a side note -

    This:

    and (cm.Original like'6%' or cm.Original like '7%' or...

    "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: Dynamically creating a @table Table from a current table

    Building off of what Scott said - a table variable is not the best choice for what you are doing because it can't be referenced outside of the dynamic 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: SQL question

    For fun, here's another option. This is a function I created a couple months ago which uses NGrams8K[/url]. The function allows you to grab everything between the mth and nth...

    "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: Staging area best practice

    So having 3 schemas in one database? is this the right thing to do or should I have a 3 separate database completely?

    It depends.

    I have seen this done both...

    "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: Rows to Columns

    erouse (9/21/2016)


    Jeff Moden (9/16/2016)


    erouse (9/16/2016)


    Can somebody please help? Is there a fairly simple way to do this?

    This is my data now.

    LABORLC

    152685A B C D E

    152969A B

    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: How do I get a substring out from a string?

    What Nicholas proposed will work provided that CN= always comes before OU=. Working with AD, I've see that this is not always the case. If this is how it 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: what affects the time it takes to create an index?

    dbodell (9/20/2016)


    You know that is an interesting comment because I recently changed the code to use MERGE instead of separate INSERT and UPDATE processes. Removing and rebuilding the indexes was...

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