Quick Question: Convert Implicit

  • I'm slightly stumped as to why I am seeing an implicit conversion seeing as though it's converting a varchar(255) to varchar(255).

    <ScalarOperator ScalarString="CONVERT_IMPLICIT(varchar(255),[MyDb].[dbo].[AGREEMENT].[REFERENCE] as [tl].[REFERENCE],0)">

    Here is the table in question

    CREATE TABLE [dbo].[AGREEMENT](

    [ID] [numeric](19, 0) NOT NULL,

    [REFERENCE] [varchar](255) NULL,

    [VERSION] [numeric](19, 0) NULL,

    CONSTRAINT [PK_AGREEMENT] PRIMARY KEY CLUSTERED ([ID] ASC));

    GO

    The server collation, tempdb collation and my user database collation are all the same, SQL_Latin1_General_CP1_CI_AS.

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • Can you provide some more information? Such as the minimum query that'll generate the implicit conversion?

    Thomas Rushton
    blog: https://thelonedba.wordpress.com

  • Not sure. I'd need to see the query and XML execution plan.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • While attempting to reproduce this in another database I discovered the issue. My user table was created with ANSI PADDING off while the temp table I'm loading was created with it on.

    The following insert will cause an implicit conversion from varchar(255) to varchar(255):

    SET ANSI_PADDING OFF;

    CREATE TABLE TestChar (MyColumn VARCHAR(255));

    SET ANSI_PADDING ON;

    CREATE TABLE #Target (MyColumn VARCHAR(255));

    INSERT INTO #Target

    SELECT * FROM TestChar;

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • Artoo22 (10/24/2012)


    While attempting to reproduce this in another database I discovered the issue. My user table was created with ANSI PADDING off while the temp table I'm loading was created with it on.

    The following insert will cause an implicit conversion from varchar(255) to varchar(255):

    SET ANSI_PADDING OFF;

    CREATE TABLE TestChar (MyColumn VARCHAR(255));

    SET ANSI_PADDING ON;

    CREATE TABLE #Target (MyColumn VARCHAR(255));

    INSERT INTO #Target

    SELECT * FROM TestChar;

    That's excellent! Well done on troubleshooting it.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Isn't the Implicit Conversion in the Computer Scalar operator simply what deals with removing (or adding depending on settings) the trailing spaces (the padding)?

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply