Forum Replies Created

Viewing 15 posts - 1,126 through 1,140 (of 2,458 total)

  • RE: Are the posted questions getting worse?

    Sean Lange (12/7/2015)


    As of today I have only taken 4 days of PTO this year. REALLY looking forward to taking the family to Disney world later this week. My wife'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: Update a table with an aggregate function

    DECLARE @TableA TABLE (ProbID int, Describe varchar(100), TableAID int);

    INSERT @TableA VALUES (1,'Describe Test the theory',1);

    SELECT * FROM @TableA;

    UPDATE @TableA

    SET TableAID = TableAID+1;

    SELECT * FROM @TableA;

    "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: Export to pdf cuts of the page

    Use print preview while developing and make adjustments accordingly. Print Preview will show you exactly what your PDF is going to look like.

    "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 Server Environment

    This is a little more BI-centric but The Microsoft Data Warehouse Toolkit, 2nd Edition[/url] had a few good chapters to help get you started. There's a good amount in there...

    "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: Selecting the record with the “nearest” date

    Can you post some DDL and sample data? It would be helpful to understand, too, where the dates in your second result set are coming from.

    "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: Copy a database between servers with one command

    Just ran across this. Good, good 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: How to add hours in SQL query

    That's not T-SQL.

    It is MDX? If it is, you'll need to look up the MDX date manipulation functions, they're not going to be the same as the T-SQL ones....

    "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 add hours in SQL query

    <removed>... somehow duplicated my post when editing it.

    "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: Generate sequence of numbers between values

    Aditya Daruka (12/3/2015)


    Recursive Solution

    -- sample date

    DECLARE @rng-2 TABLE (Id INT, RangeStart BIGINT, RangeEnd BIGINT, Category INT, NumberCount INT)

    INSERT INTO @rng-2

    SELECT 123, 120000006660, 120000006690, 5, 31 UNION ALL

    SELECT 123, 120000011660, 120000011670,...

    "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 Command Line is Back

    chrisn-585491 (11/9/2015)


    The command line hasn't gone anywhere, it can't be "back". :ermm:

    +1000

    When I first got into technology/programming in 1996 I was reading "DOS for Dummys" and remember the author...

    "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: Function to find and replace from a string where like or contains

    Luis Cazares (12/3/2015)


    Sean Lange (12/3/2015)


    Alan.B (12/3/2015)

    I am curious about a couple things here.

    Why MAX(c)?

    (MAX(c),'No Colour')

    To always return a row, either with a value or a null. I might have done...

    "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: Function to find and replace from a string where like or contains

    Sean Lange (12/3/2015)


    Alan.B (12/3/2015)

    I am curious about a couple things here.

    Why MAX(c)?

    (MAX(c),'No Colour')

    I usually do that to get a single value but don't have a clue why I did 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

  • RE: Function to find and replace from a string where like or contains

    First, I don't know if you noticed or understood the motivation by Luis' comment in his code about why he changed it to varchar(8000) from varchar(max). You only want 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: Selecting the top row from a group of records.

    It is worth noting that you will need an ORDER BY in your OVER clause for this to work.

    "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: writing queries that easily readable

    I terminate all my SQL statements with a semicolon because, apparently, you are supposed to. If anyone is interested in an intellectually stimulating article on the subject see Itzik Ben-Gan'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

Viewing 15 posts - 1,126 through 1,140 (of 2,458 total)