Forum Replies Created

Viewing 15 posts - 916 through 930 (of 4,081 total)

  • RE: SET BASED QUERY

    You do it with two separate queries. One to update table "B" and then another to update table "C".

    You are thinking procedurally, not set-based, whenever you say...

  • RE: Rounding to one decimal place.

    He's right. The round is redundundant in the second example. 😀

  • RE: Starting with "WITH"

    Not too badly, Jason. I'm enjoying every breath I take. I remember that you had moved back to Utah. How are things going...

  • RE: execute stored procedure with order by

    daveriya (11/8/2011)


    i want to order my result by 1,5 ..not with column name

    Hasn't ordering by column number been deprecated?

  • RE: Starting with "WITH"

    Has it really been a year? Oh wow....

  • RE: SQL conundrum

    No guarantees on performance, but here's your overlap logic.

    select ap.*,DATEDIFF(minute,start,[end]) as duration,ca.PersonId,ca.AvailFrom,ca.AvailTo,ca.MinutesOverlap

    from Appointments ap

    cross apply (select *,

    DATEDIFF(minute, case when AvailFrom >= ap.Start then AvailFrom else ap.Start end

    ,case when AvailTo <=...

  • RE: SQL conundrum

    ... and just TRY getting a parachute through security at a U.S. airport.

  • RE: Is a dynamic IN statement possible?

    You can approach this a number of ways. One way is to pass in a table variable containing the years to be selected.

    DECLARE @inputYears table (getyear char(4)...

  • RE: Starting with "WITH"

    Everything may be RBR, but I always thought the purpose was to keep it from being RBAR, Paul 😉

  • RE: Starting with "WITH"

    I agree with Chris.

    Because I inadvertantly started (this very entertaining and informative discussion) by making a "suckish" comment, I feel compelled to admit that I have in fact used...

  • RE: Rounding to one decimal place.

    -- if you want to specify that your output is numeric (10,1), you will have to cast or convert the result

    declare @int1 int = 4

    declare @int2 int = 5

    select cast(round(1.0*@int1/@int2,1)...

  • RE: Rounding to one decimal place.

    -- just start out by multiplying by 1.0 then round() the result

    declare @int1 int = 4

    declare @int2 int = 5

    select round(1.0*@int1/@int2,1)

  • RE: When is a scan cheaper than a seek?

    Gail and Lynn, it is also worth noting the the scan is feeding directly into a merge join, so no intermediate sorting or hashing is required for the join. ...

  • RE: Starting with "WITH"

    Recursive CTEs can also perform quite suckishly. There is nothing set-based about the recursion.

  • RE: Flexible filters - can XML be used to avoid lots of "or xxxx IS NULL"?

    Question: You say "pass in a definition", but the way I read your post it seems you are wanting to avoid dynamic SQL. If you want...

Viewing 15 posts - 916 through 930 (of 4,081 total)