1

What SQL column data type should be used to store email addresses? I'm thinking varchar(256) is probably the answer. Is there any reason it should be nvarchar(256)? I'm writing to a SQL Azure database.

How can I do client-side validation of email addresses to find out whether the user has typed a unicode character or not?

Mark13426
  • 2,569
  • 6
  • 41
  • 75

1 Answers1

1

Email addresses are allowed to have non-Unicode characters: Are email addresses allowed to contain non-alphanumeric characters?

I would as a best practice create an nvarchar column for globalization/localization support in the future (because you never know). The extra space required for an nvarchar versus a varchar is very negligible.

As far as capturing every possible character for email validation is not easy, you could write a regex function to check for this as most high level languages are Unicode compliant.

Community
  • 1
  • 1
Bart Czernicki
  • 3,663
  • 1
  • 21
  • 19