Link to home
Start Free TrialLog in
Avatar of jagoodie
jagoodie

asked on

nVarChar to VarChar

1.  Is there any script I can write to go through all of my tables to convert all of the nVarChar fields to VarChar?

2. I have found imcomplete info on this, can anyone find concrete: Do indexes on nVarchar perform slower than their VarChar siblings?

3.  When I change the type of the field from nVarChar to VarChar, do I need to recreate the index that existed on that field?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of obahat
obahat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rafrancisco
rafrancisco

You can also check this for #2:

http://www.aspfaq.com/show.asp?id=2522

"The key is that implicit conversion *can* cause a table scan instead of an index seek, and on larger tables this can really hurt. While it's important to understand why this happens and in which scenarios, my recommendation is to match your character-based datatypes as explicitly as possible. "
Avatar of Scott Pletcher
>> 3.  When I change the type of the field from nVarChar to VarChar, do I need to recreate the index that existed on that field? <<

Altering the column should automatically change the index.  Performance-wise, you might be better off dropping the index prior to the ALTER and adding it back after the ALTER.  The script could be adjusted to do that as well.


Avatar of jagoodie

ASKER

Good stuff.  Thanks everyone!