views:

103

answers:

4

Can source code examples be kept in a SQL database while retaining all formatting (tabs, newlines, etc.)? If so what data type would be used?

+1  A: 

Yes, use a TEXT type (or MEDIUMTEXT or LONGTEXT - you get the idea)

Greg
+1  A: 

A BLOB type (varbinary) would definitely work, although databases shouldn't mangle text that's stored as varchar either.

James Curran
+1  A: 

The best in Sql Server: nvarchar(max)

Ovidiu Pacurar
A: 

You can upload this into a blob data type. SQL 2008 comes with the capability of storing the entire executable file in the database.

websch01ar