You are here: Re: Programming Field Lengths « MsSQL Server « IT news, forums, messages
Re: Programming Field Lengths

Posted by Erland Sommarskog on 10/01/22 11:19

(bozzzza@lycos.co.uk) writes:
> Yhe problem is we have had some data supplied and the all the fields
> lengths are set to 255 (nvarchar), even though this is not good pratice
> we could live with it until someone else wanted a fixed length export
> of the data.
>
> So my idea was to work out the length of the fields and insert them as
> the maximum width into the new table. Then the fixed length file would
> look a lot better and cleaner.

Maybe. But what if the max lengths you find do agree with the actual
business rules? Next time you get a refresh, you could get an error
because of truncation.

So I would suggest that either you find out the actual max lengths, or
you leave the table the way it is.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация