Forum Replies Created

Viewing 15 posts - 1,231 through 1,245 (of 1,491 total)

  • RE: How to abort a transaction?

    Try putting you trigger code in a TRY block and adding a CATCH block containing the ROLLBACK statement.

     

  • RE: SELECT Query with the IN operator

    Sean and I have given you outline solutions to your problem.

    Without detailed information on your schema, and its data, it is difficult to give you more help.

    You should now be...

  • RE: problem in usin distinct clause... can any1 help me..??

    I would be interested in knowing how the following performs:

    SELECT CL.Code, CL.[Name]

    FROM Country_lkp CL

    WHERE EXISTS (

        SELECT *

        FROM SalesCountryDestination_lnk SCD

        WHERE SCD.destinationcode = CL.Code

            AND SCD.SalesCountryCode = @CountryCode

            AND EXISTS (

                SELECT *

                FROM DestinationArticle_lnk DA

                WHERE...

  • RE: JOIN question

    Try something like:

    SELECT T1.*

    FROM Table1 T1

        LEFT JOIN Table2 T2

            ON T1.CacheID = T2.CacheID

                AND T2.LogType = 'Found'

                AND T2.LogOwner = 'Sue'

    WHERE T2.CacheID IS NULL

    Putting the filters in the ON clause means they are...

  • RE: Help with creating a key

    If your site is going to be that heavily used, I suspect you will have problems timing the RESEED.

    If bigint is too small for the IDENTITY column, try decimal(38).

  • RE: Help with creating a key

    You could try leaving the IDENTITY column alone and just subtract the MAX value from the previous day when it needs to be displayed.

    To aid querying, the previous days MAX...

  • RE: SELECT Query with the IN operator

    Without example source data it is difficult to tell what you want. 

    You may want something along the lines of:

    -- Set up Tag List

    DECLARE @TagList TABLE

    (

        TagID int NOT NULL

    )

    INSERT INTO @TagList

    SELECT 35...

  • RE: Need help with a query/procedure

    Instead of using a comma delimited list of subject IDs, and dynamic SQL, try re-writing the query with static SQL and a sub-query in the IN statement.

     

  • RE: Grouping by min/max in a series

    Jeff,

    Thanks for taking the time to explain your algorithm.

     

  • RE: Recursive update

    Try something like:

    SELECT R1.*, R2.*

    FROM RegionLevels L

        JOIN Regions R1

            ON L.Level1Region = R1.RegionID

        LEFT JOIN Regions R2

            ON L.Level2Region = R2.RegionID

  • RE: Grouping by min/max in a series

    Thanks for this.

    As a matter of interest, how quick is my style of solution if there is an index on status,code?

     

  • RE: Grouping by min/max in a series

    Thanks to David le Quesne for showing me the above approach. Here is the thread:

    http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=303210&p=2

  • RE: Grouping by min/max in a series

    The logic for working out the above is:

    1. Self join the table on status where one code is less than or equal to the other code:

    SELECT T1.code AS MinCode

        ,T2.code AS...

  • RE: Grouping by min/max in a series

    The following is similar to Brian's code but should be more efficient. If you have more than 10000 rows you may be better off using cursors/temp tables.

    SELECT MIN(D.MinCode) AS MinCode

        ,D.MaxCode

        ,D.status

    FROM...

  • RE: Deadlock in SQl 2000

    Erland Sommarskog has some useful scripts at:

    http://www.sommarskog.se/sqlutil/aba_lockinfo.html

     

Viewing 15 posts - 1,231 through 1,245 (of 1,491 total)