Forum Replies Created

Viewing 15 posts - 3,946 through 3,960 (of 4,080 total)

  • RE: I need to duplicate the rows in same table , simply changing one field value

    Yes. Primary Key constraints force columns to be unique. For example, you usually have an employee ID number as a primary key for an employees table...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: How to add multiple Dates Columns together but adding only date without times

    ... and to strip off the time from a datetime column, you can use CONVERT

    declare @sample datetime

    set @sample = getdate()

    select @sample as DateAndTime,CONVERT(char(10),@sample,101) as DateOnly

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: I need to duplicate the rows in same table , simply changing one field value

    where B.col2 = '5' and B.col2 is null

    -------------------------------------------

    B.col2 can't be both '5' and NULL at the same time.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: How to count number of days in a column

    When you say a date field is "empty", does that mean the column in your table is NULL ?

    If so, you can just take a count of the rows in...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Determine if parameter is passed or DEFAULT

    My current thinking is along the lines of a trebuchet.

    Next year I'm going to have one down by my dock. Most of my buddies find...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Determine if parameter is passed or DEFAULT

    Note to self.... invent and patent pork chop slinger... the infomercials are going to be hilarious.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Help with Data transformation

    ... and now I know there is a SIGN function... which of course returns just exactly what is needed for setting the "bits". Remind me never to take...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Help with Data transformation

    Seeing no way to improve on the CASE logic in the proposed solution, I tried using a CHARINDEX test instead of a LIKE test just for grins.

    ...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Determine if parameter is passed or DEFAULT

    Ok, Jeffrey... I'll hold him while you beat the answer out of him 😉

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Determine if parameter is passed or DEFAULT

    You could always make your defaults null and then test/assign values as the first part of your proc. For example if you wanted the number 8 to be...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: One time update

    I agree about the use of an identity column instead of a trigger, but if you are determined to stick with your existing setup, the following will assign consecutive project...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: The Fear of Change

    How about this? Circa 1980, I was working for IBM and was introduced to something called SQL which we were just starting to sell as a programmer productivity...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: CAN WE USE A CASE FUNCTION INSIDE another CASE FUNCTION.

    Thanks. Sorry for letting so many days pass. They let us off early for Thanksgiving holidays.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: better way to write this update

    Your join looks the same in all cases so this might work a little faster for you. I know it looks strange to have your criteria in both...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: CAN WE USE A CASE FUNCTION INSIDE another CASE FUNCTION.

    Different search criteria don't always imply a different join. Oftentimes, tables are joined by a foreign key, but other columns are tested in the WHERE clause to determine...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

Viewing 15 posts - 3,946 through 3,960 (of 4,080 total)