简体   繁体   English

在SQL中反序列化varbinary列

[英]Deserialize varbinary column in SQL

I have done a CLR table valued function to read data form .dat files. 我已经完成了CLR表值函数来读取.dat文件形式的数据。 In DataBin column I serialized measured values and save it as a varbinary data type in SQL Server. DataBin列中,我序列化了测量值,并将其另存为SQL Server中的varbinary数据类型。 There I saved the time column with each other measured values. 在那里,我将时间列与其他测量值一起保存。

我的CLR表值函数的结果

Now I want to serialize this column and save this measured values into a table that looks like this below and save each time value with each other measured value 现在,我要序列化此列,并将此测量值保存到如下表中,并将每个时间值与其他测量值一起保存

在此处输入图片说明

Should I do a function in C# for this? 我应该为此在C#中执行一个函数吗? How will this look like? 看起来如何?

I think you should write a C# function to parse data from binary column then insert back to new table. 我认为您应该编写一个C#函数来分析二进制列中的数据,然后再插入回到新表中。

  1. Convert data from binary data object field to string 将数据从二进制数据对象字段转换为字符串
  2. Using Regex to separate data for each field 使用Regex分隔每个字段的数据
  3. Insert data from Regex result back to table database 将数据从Regex结果插入回表数据库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM