我正在尝试创建一个存储过程,但它给了我错误消息
Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_BIN2" in the EXCEPT operation.
问题是数据库和服务器排序规则都是SQL_Latin1_General_CP1_CI_AS
,我不知道Latin1_General_BIN2
排序规则是从哪里来的。
create procedure [ETL_1.4.0].update_valve_event_type
(
@data nvarchar(max)
)
as
declare @mismatch_table table(id int, [name] varchar(50))
if isjson(@data) = 0
begin
;throw 50000,'Input argument @data is invalid JSON.', 1
end
insert @mismatch_table (id, [name])
select * from
(
select
value as id,
[key] as [name]
from openjson(@data)
except
select
id,
[name]
from enum.valve_event
)data
--clear mismatches that are deemed ok, e.g. spelling corrections
delete from @mismatch_table
where id = 10 and [name] = 'FEEDBACK_FROM_USER'
if exists(select * from @mismatch_table)
begin
;throw 50000,'Terminal version of enum for valve events does not match the EDW version', 1
end
go
那么有人可以解释我所缺少的吗?
如果重要的话,这个数据库(以及与此相关的服务器)还没有上线,所以从技术上讲,我可以随心所欲地更改排序规则。