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 2005 Forums
 Transact-SQL (2005)
 what is the size difference in memory between a in

Author  Topic 

Manothinakaran
Starting Member

8 Posts

Posted - 2010-06-28 : 02:39:31
Hi Gurus,

what is the size difference in memory between a integer and a varchar(50)?

Thank you very much

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2010-06-28 : 03:31:49
What do you mean by "in memory"? An int column uses 4 bytes of space while a varchar uses 2 bytes + the number of characters in the column. So a varchar(50) with "Lumbago" in one of the rows will take 2 + 7 = 9 bytes total.

- Lumbago

My blog (yes, I have a blog now! just not that much content yet)
-> www.thefirstsql.com
Go to Top of Page

Manothinakaran
Starting Member

8 Posts

Posted - 2010-06-28 : 04:16:34
quote:
Originally posted by Lumbago

What do you mean by "in memory"? An int column uses 4 bytes of space while a varchar uses 2 bytes + the number of characters in the column. So a varchar(50) with "Lumbago" in one of the rows will take 2 + 7 = 9 bytes total.

- Lumbago

My blog (yes, I have a blog now! just not that much content yet)
-> www.thefirstsql.com




Hi Lumbago,

U answered exactly what i wanted. Im sooo thankful to you.. U have a great day ahead..
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2010-06-28 : 05:02:07
Excellent! A great day is just what I need

- Lumbago

My blog (yes, I have a blog now! just not that much content yet)
-> www.thefirstsql.com
Go to Top of Page
   

- Advertisement -