Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Converting varbinary to float array

312 views
Skip to first unread message

Cathy

unread,
Oct 7, 2009, 5:09:22 AM10/7/09
to
In SQL Server 2005, I have a varbinary(4000) column which contains a
60 element float array. Using SQL (or similar) how can I extract the
contents of the varbinary and print out the data as 60 floats? Each
float has a precision of 9 decimal places.

Many thanks,

cathy

Rahul

unread,
Oct 7, 2009, 6:10:57 AM10/7/09
to

Hi,
Please send the DDL and sample data.

Rahul

Rahul

unread,
Oct 7, 2009, 6:11:08 AM10/7/09
to
On Oct 7, 2:09 pm, Cathy <cathywigz...@yahoo.co.uk> wrote:

Hi,

Cathy

unread,
Oct 7, 2009, 6:42:52 AM10/7/09
to
Sorry, short of sending you a database backup, I can't do that

Cathy

Gert-Jan Strik

unread,
Oct 7, 2009, 2:40:19 PM10/7/09
to
Cathy,

You would need a better specification of the data format. That is why
Rahul asked for DDL and sample data. You could use SUBSTRING to extract
individual floats, CAST them to float and do with them as you please.
Depending on the data format, you have to create a cursor or loop, or
you might be able to use a set based approach using a numbers table.

--
Gert-Jan
SQL Server MVP

Erland Sommarskog

unread,
Oct 7, 2009, 6:06:31 PM10/7/09
to

tigran.g...@gmail.com

unread,
Mar 22, 2013, 7:41:49 PM3/22/13
to
Though the topic is 4 years old, just in case anyone stumbles upon it. Here's the solution for converting varbinary value to float in T-SQL. It can be applied to arrays also with some modifications.
http://multikoder.blogspot.com/2013/03/converting-varbinary-to-float-in-t-sql.html
0 new messages