Forum Replies Created

Viewing 15 posts - 1,396 through 1,410 (of 1,554 total)

  • RE: Search by Auto Fill Date

    Another method to effectively cover all times within a given day is

    select * from table

    where date_received >= '2004-08-20' and date_received < '2004-08-21'

    (assuming that you want all records from the day...

  • RE: Returning multiple values to a single column

    I noted that the main subject of that thread was "to avoid using a cursor".

    Just be aware that while "UDF" doesn't spell like "cursor", the implementation of many UDFs shows...

  • RE: "Best" method for storing status values

    I'm not going to ask the purpose of all those statuses, but I wonder if not the real problem lies in the design of the different statuses themselves.. (I'm trying...

  • RE: use when database is a variable

    Not knowing the full extent of your scripts, but this one-liner will show you the name of each database and execute sp_helpuser within the context of each db on the...

  • RE: formating the number

    Why mess around with rounding when rounding is to be avoided?

    Just cast the decimal to a string and chop it from left side to 2nd position after the decimal...

  • RE: Divide By Zero Error in WHERE Clause

    Ah, my bad.

    Didn't read the question close enough...

    In that case,

    selectCASE field2 WHEN 0 THEN 0

    ELSE (field1 / field2) END

    + ( other calcs...

  • RE: Update a table and display value

    Uniqueidentifier would however use 16 bytes, when an int only uses 4, and the format is less than 'user-friendly'.

    Personally, I'm not too fond of using uniqueidentifier as PK if it...

  • RE: Divide By Zero Error in WHERE Clause

    Hmm... how do you mean?

    If field1 is 2 and field2 is 0, you have 2/0 which is illegal.

    What you want then is 2/1 which is 2.

    Agreed, this is logically the...

  • RE: Update a table and display value

    What happens if two connections use this function at the same time..? They would both get the same number, it seems.

    Usually that isn't too good.

    When you get to the...

  • RE: Error handling in stored procedure

    It's pretty calm over at sswug as well...

    The sun must be shining somewhere

    /Kenneth

  • RE: Divide By Zero Error in WHERE Clause

    So, if field2 is 0, you want to replace this with a 1 to avoid the division by zero error.

    Try this:

    field1 / ISNULL(NULLIF(field2, 0), 1)

    The idea is that if field2...

  • RE: Error handling in stored procedure

    Isn't that nice?

    I provide you loads of opportunities to post something.

    /Kenneth

  • RE: Update a table and display value

    Actually, using identity column and @@identity opens up for some caveats. IF any triggers should be involved in the scope of the transaction on other tables with ident columns, @@identity...

  • RE: Bitwise Aggregreates

    Yup, that was the general idea.

    /Kenneth

  • RE: CREATE TABLE Vs DECLARE TABLE

    Well, the key to avoiding disk latency is to avoid all usage of tempdb and ensure that all datapages are already in cache

    Utopia...

Viewing 15 posts - 1,396 through 1,410 (of 1,554 total)