T-SQL Functions that Work with Text and Image Data

T-SQL includes ReadText(), WriteText(), and UpdateText() functions that you can use to work with the data that text, ntext, and image columns contain. However, unlike the much more powerful ADO Stream functions, these T-SQL functions are limited and somewhat cumbersome to use; they're more useful for text and ntext columns than for image data. Although you can use the T-SQL functions to manipulate binary data columns that exist in the database, you can't use them effectively to load binary data into the database. As the name suggests, you use the ReadText function to read data from a text, ntext, or image column. You use the WriteText function to write data to a text, ntext, or image column. The WriteText function always replaces all of a column's contents. With the UpdateText function, you can write data to a specific position in a text/Ntext/image column. This ability can be useful if you want to update just one part of a BLOB column.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.