Forum Replies Created

Viewing 15 posts - 14,671 through 14,685 (of 14,953 total)

  • RE: Datetime question

    Actually, if the date is "2/14/2008 00:00:00.000" and you want = "2/14/08', it will come up. But if the date is stored as "2/14/2008 12:00:00.000" and you want =...

  • RE: Accidently Agile

    I've had both good and bad Agile experiences as a DBA.

    In one case, "we're an agile shop" was used mainly as an excuse to avoid planning and documentation. Lots...

  • RE: Erorr logging to a table in a transaction before rollback

    MrAkki (2/13/2008)


    Thanks for your answer.

    The problem is, that the Rollback is initiated by the Client and not in the StoredProcedure....

    So I was wondering if I can log the errors to...

  • RE: Measuring performance on database/tables

    What you need to do is look at the long running queries in the database(s) and then analyze them for what makes them slow. I doubt it's varchar vs...

  • RE: How often should I run an index defrag?

    Yes.

    But the details vary.

    For example, if I ran an index defrag on my main production server all at once, it would run longer than the time-slot I have available for...

  • RE: t-sql complexity metrics

    I don't know what a "code complexity analysis" is. Can you clarify?

  • RE: Erorr logging to a table in a transaction before rollback

    Log them to a table variable, and in your Catch statement, insert them into the log table AFTER the rollback. Table variables don't do rollback.

  • RE: Updating part of a field

    You can use "replace" (see Books Online for details).

    Sample:

    update dbo.Table

    set Col1 = replace(Col1, "mcdonald", "MacDonald")

    where Col1 like '%mcdonald%'

  • RE: Invalid use of side-effecting ERROR

    Create a view with rand() in it, then pull from that instead of using rand() in the function. That usually works.

    create view Random

    as

    select rand() as num

    SET @RandNum = ROUND(@mn...

  • RE: find out which record_ids match on 2 fields and not match a third field.

    Try something like this:

    select distinct tempcheck_id, record_id

    from #tempcheck

    inner join

    (select tempcheck_id, min(record_id) as min_id

    from #tempcheck

    group by tempcheck_id) Sub

    on main.tempcheck_id = sub.tempcheck_id

    and main.record_id = sub.min_id

    except

    select t1.tempcheck_id, t1.record_id

    from #tempcheck t1

    inner join #tempcheck t2

    on...

  • RE: Clustered Index sort order on temp tables

    I should ammend what I just said. A table variable doesn't have a clustered index. Doesn't have any indexes. But it's common (though not guaranteed) that unordered...

  • RE: Clustered Index sort order on temp tables

    Clive Strong (2/12/2008)


    Sorry, didn't quite explain myself there. I'm not trying to make the resultsets the same.

    The two pieces of code are the same, with the exception that one...

  • RE: Clustered Index sort order on temp tables

    Move the order by clause from the insert to the select.

    DECLARE @T1 TABLE (ENTITYID INT PRIMARY KEY, entityname varchar(100))

    INSERT INTO @T1

    SELECT ENTITYID, entityname

    FROM ENTITY

    SELECT entityid FROM @T1

    order by entityname desc

    (Changes...

  • RE: Compare two Identical tables

    I just had a thought.

    Maybe something like this would work:

    create proc @Update

    (@SourceTable_in varchar(100),

    @TargetTable_in varchar(100))

    as

    declare @Script varchar(max)

    select @script = 'delete from ' + @targettable_in +

    ' where id in (select id...

  • RE: Computed Columns

    My conclusion is that having calculated, indexed columns (not persisted) can be quite useful in the right circumstances. Dates are especially subject to this, because selecting against them is...

Viewing 15 posts - 14,671 through 14,685 (of 14,953 total)