Forum Replies Created

Viewing 15 posts - 58,951 through 58,965 (of 59,048 total)

  • RE: Date error in Stored Procedure

    Cedar72,

    You've been bitten by the "time" element of datetime data types... try this as your WHERE clause...

    where datesold between DATEADD(dd,0,DATEDIFF(dd,0,@StartDate))
                       AND DATEADD(dd,0,DATEDIFF(dd,0,@EndDate))+'23:59:59.997'

    The DATEADD/DATEDIFF thingy accurately removes...

  • RE: Concat separate name fields into one

    Jana,

    Yeah, before you say anything, I see the bug, too.  Here's the corrected code... had to assume that you would have something in first name and last name fields to...

  • RE: Concat separate name fields into one

    Jana,

    Here's a real simple solution using the power of a NULL being returned when a NULL is concatenated... the key is to concatenate each space or comma with each name...

  • RE: renumbering lines

    Regardless of which method you use to do the renumbering, if Col1 is an IDENTITY column, you would need to include the following line just before the update...

    SET IDENTITY_INSERT tablename...

  • RE: Converting int to char with 0 Fill

    I dunno... David Burrows' solution doesn't use CONVERT or any form of overt concatenization (+) and may be faster as a result.  In the beginning, I used LEN, then graduated...

  • RE: Try this Quick T-SQL Quiz!

    Dummy me... missed the formatting thing... thought he didn't understand the "ELSE".  Nice job, Rockmoose!

  • RE: need help with query

    Rockmoose,

    >We do have a problem if they have breaks around midnight .. though

    Yeah, I had the same problem and decided that it wasn't so bad to use a temp...

  • RE: serious date problem (reply cannot post response)

    Sukhoi,

    I can't post back to your original post, either... I did take a look at the code you posted and all I can say is ...

    Daaannnnng that's a lot of...

  • RE: Dynamic sql to be put in a table

    Not sure from your description of the problem but I think an INSERT statement would probably do... since you didn't mention which 3 parameters you wanted to save nor which...

  • RE: Try this Quick T-SQL Quiz!

    @F3 was greater than one so the ELSE prevails giving you the exact same answer as you had in your second example.

  • RE: need help with query

    Barsuk (heck of a handle there),

    First, I hope your times look like 12:30 and not 12.30 or we'll have to do a bit more wittling...

    The key to the problem is...

  • RE: Round function

    I dunno... call me "old school"... This will always round up to the base as well. 

    SELECT ROUND(@Value/@Base+.499999,0)*@Base

    Also, just curious... why would you need to round up to...

  • RE: Critical Problem

    Sukio,

    Like I said in one of your previous posts, lookup "expanding hierarchies" in "Books on Line".  With a minor amount of tweeking, it will do exactly what you want.

  • RE: Cursor or String

    Rohit,

    The setbased logic you used in your example will almost always beat Cursors and WHILE loops.  Do you need any reason other than speed?  Ok, how about resource intensity, duration...

  • RE: i have a problem

    Sukio,

    There is an example query in "Books on Line".  To find it, lookup "expanding hierarchies" in the BOL index.  Be advised that it is not "bug free" and will require...

Viewing 15 posts - 58,951 through 58,965 (of 59,048 total)