1

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?

4 Answers 4

1

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

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

1

The best in Sql Server: nvarchar(max)

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.