I have the following content I want to insert into SQL database with the line break after each sentence, how should I do that?
INSERT INTO tblTemplateEmail (EmailID, EmailBody)
Values( 63,'Dear Manager First Name,,Welcome ! Your first step is to set up a Manager account in our system, as follows: Starting at website . Click on Manager login. Click on Setup an Account. Fill out all your information . MessageID:63.0.0')
You should probably not have to do anything special other than using the normal newline character. When you retrieve it from the DB and want to display the data, then you might want to replace the newlines with HTML <br /> tags, which may be most easily done within your application code rather than the SQL. For instance, in PHP you can use the built-in nl2br() function:
You might ask, "Why not just insert the <br /> tags into the database field?" If you do that, then you have output-specific data in there that you might not want in future uses of that data, which might mess up search functions you need to run on the data, etc.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks