简体   繁体   中英

Should I use smallint or numeric(4,0) to store a year in SQL Server

I have a limited amount of RAM available on my server. I've read about using smallint to store a year here but I was wondering if using a fixed precision number would be better on Microsoft SQL Server.

Your data type will take up storage space, not RAM. Smallint ranges from -2^15 (-32,768) to 2^15-1 (32,767) so that would probably satisfy your need.

You can see the difference in bytes between decimal/numeric , float/real , and the various ints on MSDN.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM