Forum Replies Created

Viewing 15 posts - 331 through 345 (of 2,458 total)

  • RE: Find the maxId and update the ID by 1 when a null is found

    First some sample data:

    USE tempdb; -- a safe place for testing on a dev/sandbox instance

    GO

    -- create table for storing sample data

    CREATE TABLE dbo.TableA

    (

    AssetName nvarchar(50),

    AssetID...

    "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: Creating a small banking datawarehouse

    First, Welcome - you've definately come to the right place. SQLServerCentral.com is a goldmine.

    Ditto everything Eric said. I would also highly recommend:

    Star Schema The Complete Reference

    Next, regarding 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: Very Large Transaction Causing Error 'Attempting to set a non-NULL-able column's value to NULL'

    I've always found that error to be misleading and is usually a result (in my experience anyhow) of not including a record for a non-nullable column. This will give 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: Are the posted questions getting worse?

    Me: "OK, I'll do it. You don't have to keep reminding me every 6 months!"

    Unfortunately the wife and I don't always find the same things funny. :ermm:

    "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: Desing of a table and Hirerarchy - IP's

    Welcome to SSC!

    I'm still not 100% clear on what the output should look like and this solution might not be complete but it's a start...

    DECLARE @sampledata TABLE(ip varchar(12) NOT...

    "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 use 'DECLARE' from SQL query in SSRS 2012?

    NewSSAS (12/12/2016)


    Thanks Alan. I appreciate your explanation and I agree with you.

    It worked when I removed the DECLARE and Set from the query and I am trying to set 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 do I use 'DECLARE' from SQL query in SSRS 2012?

    Yes - this logic should be put into a stored proc. What the stored proc looks like will depend on what you are doing with @Current_College_year & @Prior_College_year.

    If these...

    "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: Let the optimizer do it's thing -- wrong

    Indianrock (12/9/2016)


    I've heard this advice everywhere. Don't do things to change the way the sql optimizer produces plans etc. "it's smart so don't use plan guides, query hints,...

    "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: Anti Join question

    sgmunson (12/8/2016)


    Alan.B (12/8/2016)


    Ok, say I have two tables table1 and table2 and I want to find records from table1 that don't exist in table2 or vise-versa. I could use EXCEPT...

    "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: Anti Join question

    That FULL JOIN solution was what I'd seen before - The HAVING solution works just as well. Excellent work, thanks Luis!

    "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: Concatenate fields with separator character using XML PATH

    On a similar note, I really like CONCAT (available for SQL Serve 2012+) because it's cleaner and circumvents the need to do any casting/converting when dealing with numbers.

    DECLARE @table...

    "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: Are the posted questions getting worse?

    Jeff Moden (12/7/2016)


    This Saturday, 12/10, marks the anniversary of a very unhappy event for me...

    Ditto.

    "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: Are the posted questions getting worse?

    Doing some code cleanup today, running into lots of this

    insert into <someTable>

    select <a bunch of stuff>

    ...

    "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!

    Manic Star (12/8/2016)


    Luis Cazares (12/8/2016)


    Ed Wagner (12/8/2016)


    Revenant (12/8/2016)


    Kaye Cahs (12/8/2016)


    Manic Star (12/8/2016)


    crookj (12/8/2016)


    Brandie Tarvin (12/8/2016)


    Stuart Davies (12/8/2016)


    Ray K (12/7/2016)


    whereisSQL? (12/7/2016)


    Manic Star (12/7/2016)


    Ed Wagner (12/7/2016)


    djj (12/7/2016)


    Luis Cazares (12/7/2016)


    Ed Wagner (12/7/2016)


    DamianC (12/7/2016)


    Revenant...

    "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: coalesce in a where clause

    You don't need coalesce here. NULL values are neither equal nor unequal when compared to other because NULL is unknown. Does a bag with an unknown number of apples have...

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