views:

66

answers:

1

What's your strategy for determining nvarchar column sizes say for a address field? Do you always use nvarchar(max) or a fixed maximum size?

There is nothing worse than data integration breaking due to too small columns. What are possible implications of using nvarchar(max) vs. a fixed maximum varchar size? I understand there is something about indices getting too large but what about query performance? Is there anything else to consider?

+3  A: 

One row or field per address line, perhaps 100 long.

In ye olden days, people had to write on an envelope. No need for War and Peace epic addresses

And how would you break out post code, country, town etc if it was one field. Or lookups as Astander mentioned too.

Anyway, don't use max: there are some overhead because it's a BLOB datatype.

gbn
Also a good point might be that state/country/postcode should be part of the look ups from other tables.
astander
if you only have to deal with english, then consider varchar over nvarchar as its more efficient!
Nick Kavadias
@Nick Kavadias: yes, I'm a believer... http://stackoverflow.com/questions/35366/varchar-vs-nvarchar-performance/198753#198753
gbn
your not just a good lookin' dude with a handsome mullet, you're also smart!
Nick Kavadias