用于DB2列的SQL Server数据类型“用于BIT数据的Char()” [英] SQL Server datatype for DB2 column "Char() for BIT Data"

查看:209
本文介绍了用于DB2列的SQL Server数据类型“用于BIT数据的Char()”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用谷歌搜索,但没有找到以下问题的答案。

I googled but failed to find an answer for the following question.

我有一个数据类型为 Char(100)的 DB2 数据库列)用于BIT数据。它存储员工ID的加密值。我需要将此数据存储在 SQL Server 中。

I have a DB2 database column of datatype "Char(100) for BIT Data". It stores encrypted value of employee ID. I need to store this data in SQL Server.


  1. SQL Server中此列的数据类型应该是什么?

  2. 插入SQL Server之前是否需要任何格式?

  1. What should be the datatype for this column in SQL Server?
  2. Is there any formatting needed before inserting into SQL Server?


推荐答案

您的DB2表中的列是一个普通字符串,除了用于BIT数据部分告诉DB2将该字符串视为任意二进制数据,而不是文本。这对于排序和比较来说很重要。 DB2(通常配置)将按字母顺序对字符串进行排序和比较。大写字母A会位于小写字母b之前。但是用于BIT数据字符串是通过字符的基础数字值进行比较的。大写字母A将在小写字母z之后。

The column in your DB2 table is an ordinary character string, except that the for BIT Data part tells DB2 to treat that string as arbitrary binary data, rather than text. This matters mainly for sorts and comparisons. DB2 (as normally configured) would sort and compare strings alphabetically. A capital A would come before a lowercase b. But for BIT Data strings are compared by the underlying numeric value of the characters. Capital A would come after lowercase z.

在SQL Server中,有一个 BINARY 数据类型,因此您可能会使用 BINARY(100)。不需要格式化,因为您可能希望原始二进制数据的值保持完全相同。

In SQL server, there is a BINARY datatype for this, so you would probably use BINARY(100). No formatting should be necessary, as you probably want the value of raw binary data to stay exactly the same.

这篇关于用于DB2列的SQL Server数据类型“用于BIT数据的Char()”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆