Forum Replies Created

Viewing 15 posts - 16 through 30 (of 42 total)

  • RE: Past 3 month's average every month

    Because you said it needs to start over at the beginning of each year, I added in more rows for 2011 to test/demonstrate the results of that.

    IF OBJECT_ID('tempdb..#Totals') IS NOT...

  • RE: All INDEX details query - gives duplicate entires

    There are columns with different data, in my results:

    user_seeks, user_scans, user_lookups, and user_updates

    If you don't want the values you listed to repeat, you need to either exclude the above columns...

  • RE: Store result of stored procedure into a xml/nvarchar(max) variable

    Andrew in WV (6/21/2012)


    ColdCoffee (2/16/2012)


    THere is something called as Output Parameters while defining a Stored Procedures. Thats what you are looking for .

    Here is the link : CREATE PROCEDURE

    To...

  • RE: Aggregate Query question

    ChrisM@Work (6/21/2012)


    jeffem (6/21/2012)


    ... if order of results creates uniqueness (for example, "1 2 3" is distinct from "2 3 1"). If order of results does NOT create uniqueness, then you...

  • RE: Aggregate Query question

    ChrisM@Work (6/21/2012)


    jeffem (6/21/2012)


    ChrisM@Work (6/21/2012)


    David Webb-200187 (6/19/2012)


    Hmmmm....

    Let's say you had 50 rows, all with a quantity of 1. The target quantity was 5.

    How would you want that brought back? ...

  • RE: Aggregate Query question

    ChrisM@Work (6/21/2012)


    David Webb-200187 (6/19/2012)


    Hmmmm....

    Let's say you had 50 rows, all with a quantity of 1. The target quantity was 5.

    How would you want that brought back? All the...

  • RE: Aggregate Query question

    Les Cardwell (6/19/2012)


    Chasing,

    >>All the possible combinations of those rows that added to 5?

    All the possible DISTINCT combinations.

    In the vein of being pedantic (because that's the only way I can...

  • RE: I want to better understand execution plans

    Thanks to both of you for the replies!

    And for the excellent personal service, I'll get my company to spring for the published version of the book, instead of just...

  • RE: Date Only from Date and Time

    ChrisM@Work (6/13/2012)


    jeffem (6/13/2012)


    Though the answers have already been shared, it can be useful to have the options for CONVERT() available at your disposal. This link[/url] can be a useful primer...

    Only...

  • RE: Date Only from Date and Time

    Though the answers have already been shared, it can be useful to have the options for CONVERT() available at your disposal. This link[/url] can be a useful primer...

  • RE: Tricky SQL - Please Help

    David Moutray (6/5/2012)


    An acronym is always unknown to someone. Think of the new guy who might never have heard or seen it before.

    Also, Google is fallible. There are...

  • RE: Tricky SQL - Please Help

    Adam Machanic (6/4/2012)


    I'm pretty sure that was the AVN show, not PASS. And they were talking about colons, not commas.

    Ew.

  • RE: omit null values

    ReginaR1975 (6/5/2012)


    SELECT CASE WHEN MONTH(DueDate)=5 THEN DueDate END AS DT

    FROM [AdventureWorks].[Purchasing].[PurchaseOrderDetail]

    where DueDate is not null

    I want to clarify something that misled you here, since you're using CASE statements.

    See, the...

  • RE: Crosstab query question

    adonetok (6/7/2012)


    Thak you very much.

    It works.

    Since the date is controled by @CSV I deleted the following statement in @SQL.

    AND OrderDate BETWEEN ''' +

    ...

  • RE: Crosstab query question

    adonetok (6/6/2012)


    Hi Jeffem,

    If I want to get sum of 12 months, how to modify your existing code?

    Try this...

    DECLARE @CSV VARCHAR(4000)

    DECLARE @SQL VARCHAR(8000)

    DECLARE @StartDate DATE

    DECLARE @EndDate DATE

    SET @StartDate...

Viewing 15 posts - 16 through 30 (of 42 total)