Forum Replies Created

Viewing 15 posts - 5,626 through 5,640 (of 5,678 total)

  • RE: Compare Time

    LutzM (9/8/2010)


    Craig, you're absolutely correct regarding both statements! My fault. I'm sorry. :blush:

    I usually try to avoid using DATEPART() at all due to the side effects of DATEPART(dw,) and ...


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • RE: Slow full text search

    elayevskiy (9/7/2010)


    When I run this query on the console window I notice that results start showing up in the results window instantly and then sql server continues to pull data...


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • RE: Date Format

    Example below:

    declare @blah DATETIME

    SET@blah = '2010-09-08 13:45:00.000'

    print LEFT( datename(dw, @blah), 3) + ', '

    + left( datename( month, @blah), 3) + ' '

    + datename( dd, @blah) + ',...


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • RE: Compare Time

    LutzM (9/8/2010)


    I would prefer a solution that would be able to benefit from an index on that date column, (snip)

    Lutz, since when does a case statement in a returned column...


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • RE: Disabling @@ Commands from SQL User

    I don't have a way to turn those off, but all of your dynamic code should be used with sp_executesql using parameters to help protect against sql injection if you...


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • RE: Date Format

    In Books Online (Help-Index), look up the CONVERT() function. It will give your your date time formatting options there.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • RE: Compare Time

    Code snippet: Alter as needed

    CASE WHEN DATEPART( hour, @myDate) between 7 and 13 /*(1:59PM and lower)*/ then 1 when DATEPART( hour, @myDate) between 14 and 23 then 2 else 3...


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • RE: Columns_Updated() in update trigger reverses the bitmask?

    Please note the sample build code in the original post, where it shows that the first set of columns (for more then 8 fields) are in the most significant byte....


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • RE: Columns_Updated() in update trigger reverses the bitmask?

    Jeff Moden (9/8/2010)


    That may be true... from BOL 2k (had a handy reference there)...

    IF ( (SUBSTRING(COLUMNS_UPDATED(),1,1)=power(2,(3-1))

    + power(2,(5-1)))

    ...


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • RE: Is Identity guaranteed sequence number when mass inserting

    I've never seen a situation where it didn't unless the clustered indexing was changed (since you don't have an order by) or there's something strange going on with the identity...


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • RE: after insert trigger

    igngua (9/7/2010)


    .[EICANALESRES](

    [IdContrato] [decimal](10, 0) NOT NULL,

    [EiCanalId] [decimal](10, 0) NOT NULL,

    [EiFechServ] [datetime] NOT NULL,

    [EiFechMaq] [datetime] NOT NULL,

    [EiFechCorr] [datetime] NOT NULL,

    [EiValorFis] [decimal](25, 4) NOT NULL,

    [EiValorNum] [decimal](25, 4) NOT...


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • RE: Columns_Updated() in update trigger reverses the bitmask?

    Lowell (9/7/2010)


    remember the UPDATE() function and the COLUMNS_UPDATED() function just returns whether the column was actually referenced in the insert/update statement, NOT whether the column changed it's value;

    If I'd...


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • RE: after insert trigger

    Msg 286, Level 16, State 1, Procedure TR_WHATEVER, Line 5

    The logical tables INSERTED and DELETED cannot be updated.

    Um, errr... dang, I'd have sworn I've done that before. I'm off...


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • RE: Columns_Updated() in update trigger reverses the bitmask?

    Jeff Moden (9/7/2010)


    Data this type of thing is stored as the Least Significant Byte First (on the "left"). That's why it appears to be backwards. Then, within each...


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • RE: after insert trigger

    I think you're looking for something like:

    CREATE TRIGGER tr_test ON dbo.A FOR INSERT AS

    UPDATE inserted

    SET col1 = <value>

    where col1 = 'm'

    UPDATE inserted

    SET col2 = <value2>

    where col2 = 'n'

    END


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

Viewing 15 posts - 5,626 through 5,640 (of 5,678 total)