Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Field Length with applications (best practice) Expand / Collapse
Author
Message
Posted Tuesday, May 12, 2009 7:51 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, May 7, 2014 8:26 AM
Points: 19, Visits: 79
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.
Post #715060
Posted Tuesday, May 12, 2009 8:34 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, October 16, 2014 5:52 AM
Points: 2,551, Visits: 2,594
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

Post #715143
Posted Tuesday, May 12, 2009 11:09 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, May 7, 2014 8:26 AM
Points: 19, Visits: 79
SWEET!!!! SQL Server Central ROCKS!!!!!

This is my home for DB questions..................
Post #715310
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse