Forum Replies Created

Viewing 15 posts - 886 through 900 (of 2,458 total)

  • RE: Calendar Table Function

    Nice work, well done sir. A few things to note:

    First a couple of ticky-tacky things that aren't a huge deal but worth mentioning...

    You may want to consider using a...

  • RE: By date

    If you had a calendar table available the you can do it like this (note my code and comments):

    USE tempdb

    GO

    -- Simplified calendar table with only the columns you need

    IF OBJECT_ID('dbo.calendar')...

  • RE: Creating Combined Queries

    Phil Parkin (3/29/2016)


    Alan.B (3/29/2016)


    You would use AND.

    SELECT vend_id, prod_id, pro_price

    FROM products

    WHERE prod_price <=5

    AND vend_id IN (1001, 1002);

    Disagree. This requires an OR.

    select a from b where condition1

    union (should probably be union...

  • RE: Creating Combined Queries

    You would use AND.

    SELECT vend_id, prod_id, pro_price

    FROM products

    WHERE prod_price <=5

    AND vend_id IN (1001, 1002);

  • RE: issue with single quotes in the column values

    Can you include some DDL and sample data?

  • RE: Does it make a sense to use parallelism for single HD drive ?

    SQL Guy 1 (3/28/2016)


    And about the value for threshold for parallelism, you recommend to do some research. Can I ask what should I check for it?

    I am not an...

  • RE: Does it make a sense to use parallelism for single HD drive ?

    SQL Guy 1 (3/28/2016)


    I have a complex query with multiple joins and conditions. My test server has only one drive for data. Same for production.

    Estimated execution plan inserts...

  • RE: Running Totals with window function

    Jacob Wilkins (3/28/2016)


    DesNorton (3/28/2016)


    Thank you Sachin and Jacob. From my initial dev testing, this appears to do the trick. Now we see if the QA team can break...

  • RE: Trigger Happy

    Great article Andy, well done.

  • RE: MDX Book Recomendation

    Jon.Morisi (3/25/2016)


    I bet there's only 2 to pick from, if you can even find one. :hehe: BI books in general have been hard to come by since 2008...

    Yep.

  • RE: Running Totals with window function

    Jacob Wilkins (3/25/2016)


    Sachin Nandanwar (3/25/2016)


    ...But again it looks to cumbersome with all those conditions in the CASE expression.Your original solution is more subtle.

    Your version doesn't have to be that complicated.

    It...

  • RE: Are the posted questions getting worse?

    Anyone want to take a stab at this. Essentially the OP needs a csv splitter that handles text qualifiers; Eirikur Eiriksson's RFC-4180 compliant splitter from this article: This article[/url] would...

  • RE: Processing strings.

    Are you really on SQL Server 2008? If you were using SQL 2012 this article would get you 90% there:

    http://www.sqlservercentral.com/articles/SQL+Server+2012/106903/%5B/url%5D

    I'm going to play around with a couple ideas and...

  • RE: sql and stored procedure

    John Mitchell-245523 (3/24/2016)


    Those somewhat contrived requirements make this sound like a homework assignment. Why can't you create any temp tables or new procedures?

    John

    This is actually a common business requirement....

  • RE: Dynamic Lag Function

    Provided that the rank_pos is sequential and there are no gaps you use LEAD like this:

    SELECT t.Score, Rank_pos = ISNULL(t.Rank_pos,X.Rank_pos+1)

    FROM

    (

    SELECT score, Rank_pos, xx = LEAD(Score,1,1) OVER...

Viewing 15 posts - 886 through 900 (of 2,458 total)