Forum Replies Created

Viewing 15 posts - 3,211 through 3,225 (of 6,036 total)

  • RE: Order ID for latest order for every customer

    Lynn Pettis (1/8/2008)


    Code suggested was based on AdventureWorks database. OrderID is an identity column, therefore (and I checked) the maximum OrderID is associated with the latest order for each...

  • RE: Order ID for latest order for every customer

    Lynn, do you know the difference between "the maximum order id" and "the order id of the latest order"?

    To get the the order id of the latest order you need...

  • RE: Check if temporary table exists or not?

    Michael Valentine Jones (1/7/2008)


    The parameter that Jeff used is not undocumented. It was introduced in SQL 2005 and is documented in the SQL 2005 BOL. That is why...

  • RE: Check if temporary table exists or not?

    Michael Valentine Jones (1/7/2008)


    Your checks are not valid for SQL 7.0 and 2000. (This is the SQL Server 7,2000 T-SQL forum)

    It's because undocumented parameter Jeff used.

    Follow BOL prescriptions an...

  • RE: Index Tuning

    Clustered index must be the one used for range selections.

    I really doubt there is any case when you select empid BETWEEN @a AND @b-2.

    So, there is no point to have...

  • RE: Substituting white spaces, in a string, with nothing

    Loner (1/7/2008)


    You can also do a RTRIM(LTRIM(.....)), this will eliminate any white space.

    RTRIM(LTRIM(.....)) will eliminate only leading and trailing spaces, not the ones in the middle of the string.

  • RE: Check if temporary table exists or not?

    Loner (1/7/2008)


    Steve,

    I always use SYSOBJECT but you suggested to use information_schema.tables. What's wrong with using SYSOBJECT?

    Maybe I really need to beef up my DBA skills, I guess being a...

  • RE: Check if temporary table exists or not?

    Arun T Jayapal (1/7/2008)


    In the documentation object_id should return an integer if it finds the table object. But if I do something like

    if (object_id('tempdb..#tblTemp','u') > 0)

    print 'exists'

    else

    print 'not exists'

    ...its not...

  • RE: Finding Current Month's First Day& Last Day

    It appears flame was the most precious part of this topic.

    😉

  • RE: Capturing PRINT Messages in a temporary table

    satguru.saran (1/6/2008)


    BUt then I have seen the DBCC messages being captured in the same fashion in some of the examples that I have seen like the one mentioned below:

    INSERT INTO...

  • RE: Slow Query and High IO

    Jeff Moden (1/5/2008)


    I guess we also need to know the number of rows in the two tables, please.

    I guess execution plan shows the numbers:

    3.5631036E+7 in [pos_transaction] and 1.0039982E+8 in [postrans_sku]

  • RE: Date string in WHERE causes table scan instead of index seek

    Steve,

    index on a column used in "range" selection ("BETWEEN", ">" or/and "<", TRANS_DATE in your case) must be clustered.

    Fix it and the SP will be always fast.

  • RE: Adding a dynamic incremental column

    Jeff Moden (12/23/2007) if it's GUI code that's making hundreds or thousands of hits per second, then you should probably avoid SELECT INTO and use CREATE TABLE. In fact,...

  • RE: SQL Server 7 to 2000

    In BOL, in "Index" tab find the topic "compatibility issues, between SQL Server 2000 and SQL Server 7.0".

    If you have further questions ask it here.

  • RE: Dynamic View

    Dynamic SQL is not allowed inside of functions.

Viewing 15 posts - 3,211 through 3,225 (of 6,036 total)