我在SSIS中有一个执行sql任务,我尝试存储一个字符串值
这是查询
Declare @IdList nvarchar(max)
select @IdList = coalesce( @IdList + ''',''', '') + ID from table
Select @IdList = '''' + @IdList
Select @IdList
Run Code Online (Sandbox Code Playgroud)
结果看起来像
'abc','bcd','def','fds'
Run Code Online (Sandbox Code Playgroud)
我尝试将此值存储到SSIS中的String变量中
result set: single row
result name: 0
Variable Name: String_Contact
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误
[Execute SQL Task] Error: The value type (__ComObject) can only be converted to variables of type Object.
[Execute SQL Task] Error: An error occurred while assigning a value to variable "String_Contact": "The type of the value (DBNull) being assigned to variable …
Run Code Online (Sandbox Code Playgroud) 我有两个表A和表B,两个表中的公共列都是Name,我想知道表A中不在表B中的名称是什么
当我做:
Select Name from A where Name not in (Select Name from B)
Run Code Online (Sandbox Code Playgroud)
我确信表A中有2个名称不在表B中
但结果什么都没有
表A和B中的这些名称列具有相同的数据类型 varchar(50)
所以我将Name列的结果和Insert复制到一个新表中并执行相同的查询,这次它返回正确的结果.这会是什么bug?
例:
Table A
Name:
Kevin
Dexter
David
John
Marry
Table B
Name:
Kevin
Dexter
David
Run Code Online (Sandbox Code Playgroud)
所以查询应该返回'John'
,'Marry'
但它不会在我的原始表中返回,但它会在我创建和插入的另一个表中返回.
谢谢!