Forum Replies Created

Viewing 15 posts - 76 through 90 (of 119 total)

  • RE: EXEC permission

    Fortunately, this is a workaround that we won't need to use with SQL Server 2005, where

    DECLARE @MaxRows int

    SET @MaxRows = 100

    SELECT TOP (@MaxRows)  ....

    FROM ....

    will work nicely.

    Scott Thornburg

  • RE: Finding the Event Which Fired the Trigger

    If you only need to differentiate between actions when there are rows affected by the triggering action, you can use something like this:

    CREATER TRIGGER ...

    FOR INSERT, UPDATE, DELETE

    AS

    BEGIN

       DECLARE...

  • RE: long running stored procedure

    It's difficult to diagnose this message without more information.

    Could you post the SP code and any relevant table schemas.

    Also, check the SQL Error Log and machine event logs for any...

  • RE: reorganise data in data pages on sql server 2000

    If a table has a clustered index (which most should as a best practice) then DBCC DBREINDEX or DBCC INDEXDEFRAG rebuilds the table completely (use index id = 1 for...

  • RE: count all user objects in all databases

    You can use sp_msforeachdb as wz700 as suggested, but the query itself should be modified to something like:

    select count(*) as [?]

    from [?].dbo.sysobjects

    where OBJECTPROPERTY(id, 'IsMSShipped') = 0

    That...

  • RE: Script to display index uniqueness

    This would be much easier if there were INFORMATION_SCHEMA views for indexes.  Instead, you need to go some system table work:

    Try something like:

    select object_name(id) as TableName

         , name...

  • RE: Temporarily disabling a trigger

    Felix,

    To make a trigger carry out an action only when a specific column is updated, try the IF UPDATE (columnName) syntax:

    CREATE TRIGGER tr_MyTrigger

    ON MyTable

    FOR UPDATE

    AS

       IF UPDATE (colname)

          BEGIN

             all...

  • RE: Perfmon - Average latch wait time constantly high.

    You can also get the SQL Server Perf Monitor counters from within SQL Server from the table sysperfinfo. 

    Check out BOL or execute

    select * from sysperfinfo

    where object_name = 'SQLServer:Latches'

    to...

  • RE: IndexID = 0?

    It is not accurate to say that the table has two indexes in this case.  Unlike a table with a clustered index (IndID = 1) which is well-ordered based on...

  • RE: IndexID = 0?

    It's a little buried in BOL for DBCC SHOWCONTIG, but Index ID 0 refers to a heap table, i.e., one without a clustered index.

  • RE: Can this procedure be optimized?

    And no offense taken.  It looks like we both agree that when it comes to performance improvements, empirical testing is a must.  There is far more that can impact performance...

  • RE: Can this procedure be optimized?

    Jeff,

    Given the information available, it's not possible to say whether or not performance will improve.  This depends on the method of access of the table MASMEDIA.  If the UPDATEs are...

  • RE: Can this procedure be optimized?

    You can easily join updates that have similar where clauses except for a single condition such as the four update statements for avg_sale and avg_profit:

    UPDATE MASMEDIA

    SET    avg_sale = CASE

                                WHEN...

  • RE: Transactional Replication

    Tim,

    No, Transactional replication itself does not alter your user table schemas.  However, published tables MUST have a primary key, so in that sense, you might have to alter the tables...

  • RE: How to write a MS-SQL function that makes nvl() look like isnull()

    A while ago SQL Server Magazine website posted a method to create system functions in master that could be called from any database without prefixing the owner's name.  It was an...

Viewing 15 posts - 76 through 90 (of 119 total)