Forum Replies Created

Viewing 15 posts - 1,186 through 1,200 (of 2,648 total)

  • Reply To: Why is this query slow?

    You could try one of the following hints at the end of the SQL:

    OPTION (OPTIMIZE FOR UNKNOWN)
    OPTION (RECOMPILE)
  • Reply To: Max function and indexes

    ScottPletcher wrote:

    Jeff Moden wrote:

    ScottPletcher wrote:

    Given that the table had no index at all, I didn't think in this case that making the clus index unique was necessary, particularly to the extent...

  • Reply To: Float Issues

    Rune Bivrin wrote:

    Jonathan AC Roberts wrote:

    I think there are accounting standards that say 4 d.p. should be used for money calculations.

    Well, that would depend on your country of operation, wouldn't it?

    I don't know,...

  • Reply To: Float Issues

    Rune Bivrin wrote:

    Well, the issue with MONEY is that who's to say monetary amounts should always have 4 decimals? Often it's too much, and sometimes it's not enough. And if you...

  • Reply To: Float Issues

    Rune Bivrin wrote:

    To some extent, it gets worse with larger numbers. Try this:

    DECLARE @tmp1 FLOAT = 10e27;
    SELECT CONVERT(decimal(38,2),ROUND(@tmp1, 2)*100),
    CONVERT(decimal(38,2),ROUND(@tmp1, 2))*100,
    ...
  • Reply To: Float Issues

    Yes, a strange result. Try this:

    DECLARE @tmp1 FLOAT = 0.289;
    SELECT CONVERT(decimal(38,36),ROUND(@tmp1, 2)*100),
    CONVERT(decimal(38,36),ROUND(@tmp1, 2))*100
  • Reply To: Understanding global variables

    michael.leach2015 wrote:

    -- drop all user defined stored procedures 
    Declare @procName varchar(500)
    Declare cur Cursor
    For Select [name] From sys.objects where type = 'p'

    Open cur

    Fetch Next...
  • Reply To: Filtering data from a subquery

    Select PP_SUPP.PP_SUP_NO SupplierCode,
    PP_SAD.PP_SAD_REF SupplierAddressCode,
    GD_CST.GD_CST_FNAME SupplierFullName,
    GD_CST.GD_CST_ADD1 SupplierAddressLine1,
    ...
  • Reply To: CTE - a simpler solution?

    Looks ok to me.

    If you want non-integer averages you can do this by adding 0.0 to the count:

    with postcount (postid,postcount) as 
    (
    select postid,count(relatedpostid)+0.0 as postcount
    ...
  • Reply To: SQL Query Performance problem

    tony28 wrote:

      <li style="list-style-type: none;">

    • yesterday about 13-17hours was possible run this query only with MAXDOP 1,2,3,4
      <li style="list-style-type: none;">

    • yesterday after 18 and more was possible run only with...
  • Reply To: Join order changes query plan

    pdanes wrote:

    The plan looks the same, the estimates are the same, and it even continues to suggest that I create that same index that I just created. (Yes, it's really...

  • Reply To: Join order changes query plan

    What happens if you create the suggested index? Do both queries use it?

  • Reply To: Join order changes query plan

    There is no difference in the execution plan. Just the number of rows estimated.

  • Reply To: @@ROWCOUNT in a Exec() with identity_insert

    There is quite a lot wrong with your SQL, I've just pasted in something that will work.

    drop table [dbo].[Table_1]
    GO
    drop table [dbo].[Table_2]
    GO
    CREATE TABLE [dbo].[Table_1](
    [KEYU] [int] IDENTITY(1,1) NOT NULL,
    [DATA1]...
  • Reply To: Join order changes query plan

    There is no difference in the number of reads, so maybe (as the optimiser is a bit of a black box), in that case, the optimiser doesn't change the order...

Viewing 15 posts - 1,186 through 1,200 (of 2,648 total)