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.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 sql server columns

Author  Topic 

scamper
Yak Posting Veteran

52 Posts

Posted - 2012-05-23 : 08:05:59
I am setting up an sql server 2008 r2 database with the associated tables, views and stored procedures for one main customer only. I receive files from this customer daily. My company says that I just need to change as they change.

Basically I am trying to decide what to do with the size of a transaction code field. Up until last week, the field was a number that was a size of 3. For future expansion, I was thinking of making the field a numeric field that was size of 10.

As of last week, I started to receive values that was 1 alpha character and 2 numbers.

Thus I am trying to decide how to define the field size. I am thinking of using varchar(10) over char(10) or some smaller sized field? What size of field would you use and why?

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2012-05-23 : 08:39:54
I always use varchar unless the value of the column is always a fixed amount of characters. In your case stick to varchar(10) as it's more efficient when the number of characters varies.

- Lumbago
My blog-> http://thefirstsql.com
Go to Top of Page
   

- Advertisement -