Field Length with applications (best practice)

  • Ok as a developer we are asked to develop systems that require back end storage in this scenario the system is SQL 2005 and the developer has created a field with nvarchar(50).

    I have tested the input of the application and typed 50+ characters. When submitted to SQL the extra characters are simply dropped [(1)What is the offical name for this?]; My idea is to simply be smart enough to set the control to MaxLength = 50.

    That way the End User sees the dropping of Characters.

    What is the best practice.

    Thanks all.

  • moojjoo (5/12/2009)


    When submitted to SQL the extra characters are simply dropped [(1)What is the offical name for this?];

    "Truncation"

    moojjoo (5/12/2009)


    What is the best practice.

    Generally, its better to validate the input at the front end itself rather than accepting invalid data and avoiding the problems that may arise due to invalid data.

    --Ramesh


  • SWEET!!!! SQL Server Central ROCKS!!!!!

    This is my home for DB questions.................. 😀

Viewing 3 posts - 1 through 2 (of 2 total)

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