Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kotsas
Yak Posting Veteran
65 Posts |
Posted - 2002-03-04 : 04:34:33
|
| Please tell me something more about ansi_padding. Is good this to be on or off and why. When you create database default value is off???ansi_padding is on database level??? Is so how can I enable that.I have problem with one table when I alter it it give nme warning that new column will be with with ansi_padding ON and already existin columns are with ansi _padding OFF. What to do??Thanks |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2002-03-04 : 18:04:54
|
In BOL, it says:quote: ANSI_PADDINGWhen set to ON, trailing blanks in character values inserted into varchar columns and trailing zeros in binary values inserted into varbinary columns are not trimmed. Values are not padded to the length of the column. When set to OFF, the trailing blanks (for varchar) and zeros (for varbinary) are trimmed. This setting affects only the definition of new columns. Char(n) and binary(n) columns that allow nulls are padded to the length of the column when SET ANSI_PADDING is set to ON, but trailing blanks and zeros are trimmed when SET ANSI_PADDING is OFF. Char(n) and binary(n) columns that do not allow nulls are always padded to the length of the column. Important It is recommended that ANSI_PADDING always be set to ON. SET ANSI_PADDING must be ON when creating or manipulating indexes on computed columns or indexed views.
I can't say I've delved into this topic much, but I can't think of a reason why I would want trailing spaces retained in a varchar column. In fact, the main reason I use varchar is to get rid of trailing spaces and the trailing headaches they can cause. But maybe someone else can explain why this is a good thing and why Microsoft would encourage it to be set ON.------------------------GENERAL-ly speaking... |
 |
|
|
|
|
|