Determine size of a text/image field

October 21, 2009

When trying to extract data from a text or image field, it is not always clear, how many bytes of data can be expected. Here's a way how to determine this:

 
1> SET textsize 1669842
2> go
1> SELECT Xml FROM TradeXml WHERE AsOfDate = '20091019' AND TradeId = 'xxxxxxx'
2> go
 

In order to determine the value that needs to be set for "textsize", use this query:

 
1> SELECT datalength(Xml) FROM TradeXml WHERE AsOfDate = '20091019' AND TradeId = 'xxxxxxx'
2> go
 
 -----------
     1669842
 

This determines the size of bytes for the data field query.

tags: , , ,
posted in ase by Carsten

 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org