Forum Replies Created

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

  • RE: Table vs View vs UserDefined Function - Which will give more performance

    Sergiy (12/7/2015)


    Alan.B (12/7/2015)


    I'm with what everyone has said so far. I would add, however, that, if you are doing aggregations, you might want to consider an indexed view 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: Table vs View vs UserDefined Function - Which will give more performance

    I'm with what everyone has said so far. I would add, however, that, if you are doing aggregations, you might want to consider an indexed view with the aggregations indexed....

    "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 to remove trailing special characters

    This is how you would remove them only at the end:

    DECLARE @table TABLE (col1 varchar(100));

    INSERT @table VALUES ('address1'),('address2'+char(10)+char(13)),('address3');

    SELECT

    CASE

    WHEN col1 LIKE '%'+char(10)+char(13)

    THEN...

    "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: Gale-Shapley algorithm

    Joe Celko has the stable marriage problem (which I believe you are looking for) in his book: SQL Puzzles and Answers 2nd edition.

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

    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

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