Forum Replies Created

Viewing 15 posts - 3,106 through 3,120 (of 5,502 total)

  • RE: Average Inventory (Stock) Age

    I think the following solution will cover all scenarios:

    DECLARE @ProductID INT

    DECLARE @Runbalance INT

    DECLARE @StockDays INT

    DECLARE @RunningBalance INT

    UPDATE [dbo].[temp_AVDays]

    SET

    @runbalance = runbalance...

  • RE: Improve query performance with comma separated result of each member.

    Paul White NZ (7/19/2010)


    ...

    I do use table variables quite a lot, but each has its own advantages and disadvantages, as Wayne clearly shows in his article.

    Paul

    Absolutely agreed.

    And based on...

  • RE: Improve query performance with comma separated result of each member.

    Sagar Sawant (7/19/2010)


    Eugene,

    I have applied necessary changes in query.

    If I removed below code from sql query then query executed in 2 seconds.

    ,str_SourceID=STUFF(( SELECT ','+ str_SourceOfData FROM tbl_MARC_MemberSourceData MSD,tbl_MARC_SourceMaster SM

    WHERE...

  • RE: How do I calculate the week number given a date?

    Like I stated in my first post: It depends on the requirement.

    You cannot use DATEPART() if you need to get the week as per ISO specification.

    Furthermore, DATEPART(WEEK,somedate) will return different...

  • RE: Average Inventory (Stock) Age

    I think the solution I posted will not cover all scenarios (e.g. if the 2nd or 3rd ProductID will have a stock less than the amount received last).

    I'll have a...

  • RE: Average Inventory (Stock) Age

    gah (7/18/2010)


    gah (7/18/2010)


    ...

    Guys...anyone care to help me out on Lutz's #1...seem to be strugglng at the mo

    any ideas most appreciated...thanks

    Graham

    ????

    I'm kinda confused...

    The code I provided include the following line:

    ELSE ISNULL(@RunningBalance,Current_Stock)...

  • RE: Average Inventory (Stock) Age

    Hi gah,

    GREAT JOB!!!!

    As far as I can see, this solution will work.

    I would make two changes:

    #1: you need to cover the scenario where your stock is less than the amount...

  • RE: arranging columns

    Your c.u.r.s.o.r (*cough*) suffers the same problem David and myself were talking about: there is absolutely no guarantee to get the rows back in the same order as the rows...

  • RE: Improve query performance with comma separated result of each member.

    Several things:

    #1: 2 seconds and 1.36 seconds, respectively, are both below your target of 5 seconds 😀

    #2: instead of using a table variable you should use an indexed...

  • RE: joins to the same table

    What would be your expected result other than what you already have?

    Isn't the result already what you're looking for?

  • RE: SELECT just one instance from multiple values

    Yes, it's possible.

    Have a look at "GROUP BY".

  • RE: distinct again

    duplicate post.

    Discussion alread started here.

    @scottichrosaviakosmos

    Is there any specific reason for starting a separate thread with an identical subject instead of simply answering the question I asked?

  • RE: Newbie sp_xml_preparedocument

    (o_0) (7/10/2010)


    thanks for the replies guys.

    they were very helpful. 🙂

    any idea which is more efficient to use?

    nodes method or openxml?

    since both of them have the same output.

    just curious though..

    I did...

  • RE: distinct columns

    It's not clear to me what you're looking for.

    What rows do you want to return?

    Simple scenario:

    col1col2

    A11

    A12

    A23

    A24

    What would be your expected output?

  • RE: How do I calculate the week number given a date?

    There are several concepts depending on what type week number you're looking for.

    If you need the week numbered as per the restrictions described in BOL (BooksOnLine, the SQL Server help...

Viewing 15 posts - 3,106 through 3,120 (of 5,502 total)