|
I am trying to prove that Char takes the memory even if it has NULL values. Is there any function other than length and datalength?
(comments are locked)
|
...or the handy Atlantis Data Space Analyzer--which I would recommend
Jun 30 '10 at 03:14 PM
Scot Hauder
@Scot Hauder - :) thanks!
Jul 01 '10 at 01:55 AM
Matt Whitfield ♦♦
might help to replace zed with S when Googling :)
Jul 01 '10 at 05:33 AM
Scot Hauder
(comments are locked)
|
|
Why do you need to prove it? Read this http://msdn.microsoft.com/en-us/library/aa258242(SQL.80).aspx As you can see CHAR is a fixed length variable, but if you SET ANSI_PADDING OFF when CREATE TABLE or ALTER TABLE is executed, the char column defined as NULL is handled as varchar. Congrats on the 3k sir :)
Jun 30 '10 at 03:14 PM
Matt Whitfield ♦♦
Thank you sir! I have been too busy the last months to keep up with you guys. :) I now work at a company dedicated to SQL server and we have been very busy, but I haven't forgot about AskSSC.
Jun 30 '10 at 03:39 PM
Håkan Winther
(comments are locked)
|
|
Hakan is completely right, but this question made me think about how to show it expirmentally. So I created a new database, and created one table: After that, the database had a size of 3.0 MB with .88 MB free on my system. I then populated that table with 10000 rows of null. After that insert, the size of the database was 179.75 MB with .69 MB free space. This of course is precisely what you would expect from the reference Hakan provided, but it gives you an experimental demonostration for people that like to see it happen. +1 - He asked for proof - you give him proof. All good.
Jun 30 '10 at 03:14 PM
Matt Whitfield ♦♦
thanks...,
Jun 30 '10 at 10:56 PM
sqlfrenzy 1
@Matt, your answer appeared between when I started on mine and finally finished (I was interrupted by a question in between so that was a long time).
Jul 01 '10 at 06:11 AM
TimothyAWiseman
(comments are locked)
|

