Forum Replies Created

Viewing 13 posts - 2,881 through 2,893 (of 2,893 total)

  • RE: select Last not null field in a datetime range

    Sorry, but your anwers made it even more obscure:

    What you mean by "the last not null field"?

    1. Do you want to select AskSideRWsize if the BidSideRWsize is null?

    use ISNULL(BidSideRWsize,...

  • RE: select Last not null field in a datetime range

    What you mean by "the last not null field"?

    1. Do you want to select AskSideRWsize if the BidSideRWsize is null?

    use ISNULL(BidSideRWsize, AskSideRWsize)

    2. If both values (AskSideRWsize...

  • RE: Help with Query

    "Quirky Update" way

    Here we are:

    1. I would not use it if I would be you.

    2. If you deside to use it, you must read

    "The RULES" section of...

  • RE: Help with Query

    I had typo in my query. New one should give you your expected results:

    ;WITH PrevDate

    AS

    (

    SELECT f.ClientCode, f.FlowDate, f.TempletID, f.AssetCode, MAX(f1.FlowDate) as PrevFlowDate

    FROM #Flows f

    LEFT JOIN #Flows f1

    ON f.CLientCode...

  • RE: update statement with isnull and nullif functions.

    Just another small advice:

    Don't use stored proc input parameters directly in the WHERE clause of query, copy them into the local variables first and use the local variables instead.

    It will...

  • RE: Why hangs up on one UPDATE query?

    Try to update table statistics after update:

    UPDATE STATISTICS WC_PERSON_F_M_CN

  • RE: update statement with isnull and nullif functions.

    As being minimalist, the following single line will also work to set your param to null if it is a blank (or spaces) without any trims and checks for length...

  • RE: Help with Query

    Is it what you want?

    ;WITH PrevDate

    AS

    (

    SELECT f.ClientCode, f.FlowDate, f.TempletID, f.AssetCode, MIN(f1.FlowDate) as PrevFlowDate

    FROM #Flows f

    LEFT JOIN #Flows f1

    ON f.CLientCode = f1.ClientCode

    AND f.TempletID = f1.TempletID

    AND f.AssetCode = f1.AssetCode

    AND...

  • RE: Divide by zero error when using CASE statement

    You are welcome!

    As I said in my post, each devider in your monster formula should be checked for zero value.

    I have gut feeling that this spaggeti-formula can be significantly cut...

  • RE: Calculate XIRR in SQL Server

    OK,

    Here we are:

    1. We create a sample table

    create table txns

    (

    PmtAmount money

    ,PmtDate Datetime

    )

    insert into txns

    select -2750,'20080205'

    union select 1000,'20080705'

    union select 2000,'20090105'

    2. Then we calculate your...

  • RE: Calculate XIRR in SQL Server

    That the good one!

    There are no such thing in SQL!

    You can code it yourself if you wish and have time to do so (you will need to find...

  • RE: Divide by zero error when using CASE statement

    Your formula looks a bit strange, especially the place where you substructing 1.

    You can try the following:

    ISNULL(

    (

    (

    (

    ...

  • RE: SQL 2005 Trigger Help Needed

    If you are really need to implement this logic in a trigger, use INSTEAD OF one. With appropriate compatibility level (80 or higher) - it should work.

Viewing 13 posts - 2,881 through 2,893 (of 2,893 total)