Forum Replies Created

Viewing 15 posts - 4,021 through 4,035 (of 5,393 total)

  • RE: Strange UNION ALL behaviour

    No, the two queries get absolutely different plans when unioned together.

    That's what I don't understand. How can UNION ALL change the plan so dramatically?

    As a side note, yesterday (when I...

    -- Gianluca Sartori

  • RE: Rows Affected by a select query for sp_send_dbmail

    Replace your code with this:

    SET @sql = '

    SELECT CAST(co.InvoiceNo as varchar(10)),

    CAST(co.CustomerNo AS VARCHAR(10)) + '' - '' + co.CustomerName,

    ...

    -- Gianluca Sartori

  • RE: Rows Affected by a select query for sp_send_dbmail

    What error are you getting?

    -- Gianluca Sartori

  • RE: Function or procedure?

    Paul White NZ (7/1/2010)


    In fact, scalar functions and multi-statement table-valued functions are cached almost identically to stored procedures (as the dynamic management views like sys.dm_exec_cached_plans will show you). Scalar...

    -- Gianluca Sartori

  • RE: Rows Affected by a select query for sp_send_dbmail

    You could test for existing rows prior to invoking sp_send_dbmail.

    Something similar to this:

    DECLARE @sql nvarchar(4000)

    DECLARE @sqltest nvarchar(4000)

    DECLARE @testResults TABLE (rowsAffected int)

    SET @sql = 'SELECT someColumn FROM someTable'

    SET @sqltest = 'SELECT...

    -- Gianluca Sartori

  • RE: Using Function in JOIN

    I agree with Dave: get rid of that function if possibile.

    If not, try adding WITH SCHEMABINDING to the function definition: it should mark the function as deterministic and avoid a...

    -- Gianluca Sartori

  • RE: Are the posted questions getting worse?

    Dave Ballantyne (6/30/2010)


    Coincidence ? , homework ? or left hand not talking to right hand ?

    Both similar problems , 2000 to 2008 upgrade , udf performance

    http://www.sqlservercentral.com/Forums/Topic945233-392-1.aspx

    http://www.sqlservercentral.com/Forums/Topic945210-392-1.aspx

    It can't be coincidence!...

    -- Gianluca Sartori

  • RE: Drop Clustred index on primary key

    You will have to drop the primary key and re-create it nonclustered.

    The primary key and the associated index have to live together and cannot be dropped/created separately.

    -- Gianluca Sartori

  • RE: STOP SERVER

    Have you tried stopping SQL Agent first? It should prevent that prompt from showing.

    -- Gianluca Sartori

  • RE: Flag Duplicate Reocrds with fairness to Data Sources

    Probably there's a better solution, but this is what I could put together quick'n'dirty:

    -- Test table

    DECLARE @Names TABLE (

    FirstName varchar(50),

    Surname varchar(50),

    Source int

    )

    -- 1st set of duplicates

    INSERT INTO @Names...

    -- Gianluca Sartori

  • RE: Formatting and Readability

    Standards... that's why I love formatting tools: everyone with the same formatting standards, like it or not.

    BEGIN AD

    We use SQLRefactor and we're very happy with it. I've seen around other...

    -- Gianluca Sartori

  • RE: Formatting and Readability

    Jeff Moden (6/30/2010)


    david_wendelken (6/30/2010)


    It's also easier to comment out a line starting with a comma when debugging.

    Actually, it's not. It's only easier to comment out the last line with...

    -- Gianluca Sartori

  • RE: Are the posted questions getting worse?

    Steve Jones - Editor (6/30/2010)


    Gianluca Sartori (6/30/2010)


    I initially posted a cross-post warning on both threads and I realized they were not the same problem and different OPs...

    Removed your "removed" posts.

    Thank...

    -- Gianluca Sartori

  • RE: Function or procedure?

    Function can mean Scalar Function (slowest), Multistatement Table-valued Function (slow) or Inline Table-Valued Function (quite fast).

    Functions don't have predetermined cached query plans, stored procedures do.

    I think the real tie-breaker...

    -- Gianluca Sartori

  • RE: cast/convert with no trailing zeroes

    I think you're confusing the way data should be stored internally with how it should be presented to the users.

    It's not a conversion issue, it's just how you format data...

    -- Gianluca Sartori

Viewing 15 posts - 4,021 through 4,035 (of 5,393 total)