Storing ampersand in the database

I am currently working with the sql 2008 database. Many of the records have ampersands stored in this way, Art and Culture. Should we store the saved version in the database? Any thoughts are greatly appreciated.

+1
source share
2 answers

Generally speaking, everything in the database should be kept as close as possible to the original version. If you need to perform any escaping, do it outside the database.

The reason for this is simple: it is only on the Internet where you must use the & sign. If you ever have a non-web interface for your database, you will have to convert these escape sequences back to the original value, which is not always possible: for example, if the user enters & (sic), if you convert it again, it will be translated to & , which will lose its original value.

+11
source

SQL Server will store Arts & Culture just fine, in the VARCHAR (x) or NVARCHAR (x) field (Unicode-variant - 2 bytes per character).

From the point of view of the database, there is absolutely no need or sense to avoid anything.

+1
source

All Articles