【发布时间】:2016-11-05 18:21:57
【问题描述】:
当我进行复杂查询并尝试过滤掉 varchar 类型列上的数据时,在 sql 代码中转换所需变量的提供程序不在“where”块中,并声明了一个 NVarchar 类型的变量并分配它一个值。并阻止“where”添加对该变量的搜索。
-- SqlServer.2008
DECLARE @cashRegisterNumber NVarChar -- String
SET @cashRegisterNumber = N'0705311'
因为默认 nvarchar 类型的长度为 1,所以它会查找第一个字符。如何克服,让它看起来全线?
【问题讨论】:
-
您好,欢迎来到 StackOverflow。请花一些时间阅读帮助页面,尤其是名为"What topics can I ask about here?" 和"What types of questions should I avoid asking?" 的部分。更重要的是,请阅读the Stack Overflow question checklist。您可能还想了解Minimal, Complete, and Verifiable Examples。