Forum Replies Created

Viewing 15 posts - 2,866 through 2,880 (of 2,893 total)

  • RE: Create a self referencing table from join of 2 tables

    For the future, please supply create table and data insert scripts together with question. It will help helper 🙂

    That is what you need:

    DECLARE @FirstTable TABLE

    ( ParentID int , ParentName...

  • RE: TSQL Debug Logging

    I am wondering what your log sp logs when the main sp does something within transaction and transaction is rolled-back. Unlike Oracle there is no autonomous transaction concept in SQL...

  • RE: Statement Errors But Resturns Results Anyhow

    UMG Developer (5/14/2010)


    I am having a problem where an Access application executes an adhoc SQL string which generates an error, the problem is that SQL Server 2005 (SP2 CU15) returns...

  • RE: Find PreviousChange of date

    Try this:

    SELECT *

    FROM (SELECT ROW_NUMBER() OVER (PARTITION BY PropID

    ORDER BY LatestApptDate desc ) AS PARowNumber

    ,PrevApptID

    ...

  • RE: Optimize query in 2005

    There is no straight answer to this. Its depends on many factors.

    For begining you can just add non-clustered indices for all these columns.

    And see if the query will start using...

  • RE: freetext problem

    It is well known issue with SQL Server full-text predicates.

    You can use dynamic sql with sp_executesql or -

    I have once used the following and it did work:

    IF ISNULL(@Param,'') =...

  • RE: Optimize query in 2005

    First of all. You should better use JOIN for joining tables:

    select A.DTrackID, A.DVersion, A.Version, ...

  • RE: ASSERTION , SUM(POSITION()) in SQL2005

    Does SQL2005 support CREATE ASSERTION statement?

    >NO, you will need to use CHECK constraint (unfort. a bit different to SQL-92 CREATE ASSERTION idea)

    Does Sql2005 support SUM(POSITION()) ?

    >NO, use CHARINDEX/PATINDEX instead

  • RE: Help with Query

    Jeff Moden (5/12/2010)


    elutin (5/12/2010)


    1. Quirky Update is very fast, but has some limitations and it is using undocumented feature of the SELECT. If you've read the article I've mentioned...

    Yet you...

  • RE: select Last not null field in a datetime range

    Small modification to the given query will do what you want:

    ;WITH CTE as

    (

    SELECT MAX(TickID) AskSideRWsizeTickID

    FROM #TABLE WHERE AskSideRWsize IS NOT NULL

    UNION...

  • RE: sp_senddbmail return code 0 but mailitem_id is NULL

    Check this one:

    http://sql-articles.com/blogs/return-code-values-documentation-for-sp_send_dbmail-procedure/

    Most likely you have an error in your query, which can be due to some security issues...

    Check what the query string contains and execute it within SP.

    Actually, I...

  • RE: sp_senddbmail return code 0 but mailitem_id is NULL

    add the following to see what this sp returns:

    DECLARE @RtnCode INT

    EXEC @RtnCode = msdb.dbo.sp_send_dbmail...

    Check what is returned in the @RtnCode.

    0 - success, 1- failure.

    BUT! There are some more undocumented return...

  • RE: Help with Query

    1. Quirky Update is very fast, but has some limitations and it is using undocumented feature of the SELECT. If you've read the article I've mentioned, you have seen that...

  • RE: sp_senddbmail return code 0 but mailitem_id is NULL

    Can you please include the exact line of code where you are calling sp_send_dbmail?

    Can you see the "Mail queued." message, which is returned on success?

    When the user sending the message...

  • RE: Optimize query in 2005

    There is very simple answer to your question:

    To increase your query performance you just optimize it using well known query optimisation techinques.

    I do hope my detailed answer will help you...

Viewing 15 posts - 2,866 through 2,880 (of 2,893 total)