Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Sql Server Programming

varchar verses char


Please clarify for me.

With nvarchar and varchar, my understanding is that the storage
space required is dependant on the actual size of the data being inserted.

That being said, what is the downside of using nvarchar(50) as opposed to
nvarchar(500)?
..and aside from the 1 byte used for size designation in varchar, are there
other pros
to using char(n)  as opposed to varchar(n)

thanks in advance,
bob.

Bob, see inline

Bob wrote:

> Please clarify for me.

> With nvarchar and varchar, my understanding is that the storage
> space required is dependant on the actual size of the data being inserted.

Correct.

> That being said, what is the downside of using nvarchar(50) as opposed to
> nvarchar(500)?

You cannot index columns with (potentially) more than 900 bytes. The
obvious downside of using nvarchar(50) as opposed to nvarchar(450) is
that it cannot hold as much data. Other than that, not much to say about
it.

> ..and aside from the 1 byte used for size designation in varchar, are there
> other pros
> to using char(n)  as opposed to varchar(n)

For starters, it is 2 bytes for the string length. Then, the first
varying column will 'cost' a few bytes more, just to indicate that there
are varying length columns in the row. That about covers the space
considerations.

Then there is the topic of in-place updates and fragmentation. I am sure
you will get a lot of hits if you google the newgroup archives, because
your question is definitely a FAQ.

Gert-Jan

Exactly what I needed
Thanks Gert-Jan!

"Gert-Jan Strik" <s@toomuchspamalready.nl> wrote in message

news:4665CDE8.AC4DFB7A@toomuchspamalready.nl...

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc