PDA

View Full Version : Embed a carriage return into your result set



FerencMantfeld
2nd March 2010, 08:40 PM
If you need to break a string up and embed a carriage return somewhere logically in your dataset, when using the ASCII collating sequence, character 10 (hex 'A') will do this for you.

For Oracle:
http://www.seemoredata.com/en/../wiki/_media/tips:sql:cr_ora.png (http://www.seemoredata.com/en/../wiki/_detail/tips:sql:cr_ora.png?id=tips%3Asql%3Aembed_carriage _return)

For Sql Server
http://www.seemoredata.com/en/../wiki/_media/tips:sql:cr_sql.png (http://www.seemoredata.com/en/../wiki/_detail/tips:sql:cr_sql.png?id=tips%3Asql%3Aembed_carriage _return)

Note: when using Query Analyzer or Sql Management studio, carriage returns are stripped out. So if you see no carriage return using either of these interfaces, it does not mean that it is not there, just merely that the Microsoft interface tool has stripped it out.

http://www.seemoredata.com/en/../wiki/_media/tips:sql:cr_sql2.png (http://www.seemoredata.com/en/../wiki/_detail/tips:sql:cr_sql2.png?id=tips%3Asql%3Aembed_carriag e_return)