Forum Replies Created

Viewing 15 posts - 46 through 60 (of 81 total)

  • RE: Cant format date for insert statement

    try this...

    cast( cast(@NEXT_YEAR as char(4)) + '-07-01' as smalldatetime)

    if you make the date up using a region specific date format then it could go wrong at some point.

    jon

  • RE: Stumped by SUM query (and requesting help..)

    ok - you probably want the sum on your ordered amount on the result of the group by...

    select code as ordercode, sum(ordered_amt) as total_amount_ordered, sum(assigned_amt) as total_amount_assigned

    from(

     select o.code, d.productcode, d.amount as...

  • RE: Inserting into tables with indentity turned on

    In that scenario, I'd suggest that an identity field may be making your life harder than it needs to be.

    You could have a unique sys ref (maybe an identity) and a...

  • RE: Stumped by SUM query (and requesting help..)

    think you didn't mean to sum by amount.?..

    select o.code, d.productcode, d.amount, sum(a.amount)

    from orders o

    join details d

    on d.orders_id = o.orders_id

    join assigned a

    on a.details_id = d.details_id

    group by o.code, d.productcode, d.amount

    jon

     

  • RE: For XML Explicit AGAIN

    You could put everything you want into the select and arrange for the attributes you don't want to be null on some criteria - then they won't appear in...

  • RE: The return value of sp_XM_reomvedocument.

    Tried it with the same result - also tried on some code we've been using loads (with no problems, fingers crossed ) and that...

  • RE: convert float to string

    whew - only 5 mins to open this page! sites a bit slow for me at the mo

    you can use the format-number function...

  • RE: TSQL Help

    you could try using locking hints (see Locking Hints in BOL) to stop anything else from accessing the batch table while your transaction is going on, though if a lot...

  • RE: CASE With a Calculated Value

    You're not going to be able to reference MonthsOfStock in the above example because as far as the case statement is concerned it doesn't exist - you could put the...

  • RE: Possible Query Analyzer Bug

    I'd guess you've not got ordinary quotes from Word - it does tend to use different characters and put in fancy quotes (single and double) rather than normal ones.

    Can't think...

  • RE: One row or two?

    Sounds like the kind of situation where you want to do a subquery early on with the select distinct in it - to basically build an index/limit of the participants you...

  • RE: One row or two?

    depends what's in you 2 tables

    assuming there's only one row in tblParticipant for each participant then you'll only get multiple rows if there's a one to many relationship with tblDonorMailFlag.

    From...

  • RE: FULL TEXT SEARCH PROBLEM

    you should be able to declare a temp table or table variable and insert the results into that, then use your cursor against the table of results

    eg

    DECLARE @tbl TABLE (..........)

    INSERT...

  • RE: How can i do this on DATEDIFF between date

    maybe something along these lines...

    declare @d1 datetime

    declare @d2 datetime

    set @d1 = '2004-05-01 06:40.000'

    set @d2 = '2004-05-02 10:00.000'

    select cast( datediff(d, @d1, @d2) as varchar(10))

     + ' days and ' +

     cast( (datediff(hh, @d1, @d2)%24)...

  • RE: Cartesian queries

    yep, it's just multiply all the row counts

    don't the users notice that their results don't make sense (I'm assuming they don't)?  actually, don't answer...

Viewing 15 posts - 46 through 60 (of 81 total)