T-SQL Question

  • Does anybody know if there are any implications to joining VARCHAR columns from different tables that are different sizes? 

    i.e. Table 1 - Column1 - VARCHAR(255)

         Table 2 - Column1 - VARCHAR(25)

    I assume if the length of the data is 20, that there will be no adverse effect.

    Any help would be appreciated.

     

     

  • Counterquestion:

    Why do the columns that you join on have different datatype length?

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • I'm new to the company and have found that a lot of the tables in the Data Warehouse are set for VARCHAR(255).  As the max row size in SQL is 8060 and a number of the tables exceed this, I have set the columns in this newly created table to more sensible sizes.

    Thus Table1 - Column1 =  VARCHAR(255) and table2 - Column1 = VARCHAR(25)

     

  • Sounds like a port of an old Access app

    But to answer your question, I don't think there should issues when joining both columns. But if you could narrow the columns anyway, I would prefer this. Would also make your schema more readable and easier to understand.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • From speaking to one of the guys here, he tells me it is a port of an old access app.

    thanks for your help.

     

    Carl

  • From speaking to one of the guys here, he tells me it is a port of an old access app.

    Sorry about that.

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

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

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