开发者

SQL Server VARCHAR(10)

When desiging a table in SQL Server Management Studio 2005, if I specify VARCHAR(10) for a column, when I tab away from the data type, SQL Server changes it to VARCHAR(50). I have to then tab back, change it back to VARCHAR(10), and it will then accept it.

I understand tha开发者_Go百科t there are storage and processing considerations that may make VARCHAR(10) equivalent to CHAR(10) for all intents and purposes, but is there something I'm missing? Is there enough of a reason that I'm not considering, that the default behavior of the designer is to automatically change the length of the column from what I've specified?


No, it's a bug in SSMS when you tab away from a field. It does get irritating.


probably it's just a bug in the designer.


I would strongly suggest never using the designer to create a table or change a table structure. You should write a create table or alter table statement for that and put it into source control. Then it is easier to deploy to production.


No, there's absolutely no reason for designer to change data type. And I cannot reproduce it in Management Studio 2008.

If you're so into designer, create a UDT (User-Defined Type) and use it instead of varchar(10):

create type dbo.MyChar from varchar(10) not null


I would strongly recommend switching to Toad for SQL Server to get rid of all those annoyances..


It is a bug in ssms 2008 when you go somewhere else without clicking the data type it takes default setting as varchar(50)..so dont worry and no need to think, just handle it carefully..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜