You are here: Re: How to have strings automatically truncated? « MsSQL Server « IT news, forums, messages
Re: How to have strings automatically truncated?

Posted by Erland Sommarskog on 03/02/06 01:16

John Bokma (john@castleamber.com) writes:
> "String or binary data would be truncated"
> Can MS SQL automatically do the truncation?

Yes, if you issue the command SET ANSI_WARNINGS OFF.

However, this is not really recommendable, as there are functionality
in SQL Server that requires ANSI_WARNINGS to be on.

So you are better off by truncating the data yourself, for instance
with cast or convert. Or bounce thata over a variable. SQL Server does
not complain if you assign a variable with an overlong value.


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

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

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

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