uniqueidentifier部类字段,在trigger的inserted中select出来后默认转换为了smallint类型
uniqueidentifier类型字段,在trigger的inserted中select出来后默认转换为了smallint类型
sql server 2008
uniqueidentifier类型字段,
在trigger的inserted中select出来后无法赋值给uniqueidentifier类型变量,
赋值时报错:操作数类型冲突: smallint 与 uniqueidentifier 不兼容。
就像是在inserted中uniqueidentifier 字段被转换为了smallint?
create table tb_test
(
Id uniqueidentifier
)
go
CREATE TRIGGER tr_test_insert
ON tb_test
AFTER INSERT
AS
BEGIN
SET NOCOUNT ON;
declare @Id uniqueidentifier
select @Id=Id from inserted--报错:操作数类型冲突: smallint 与 uniqueidentifier 不兼容
END
go
------解决思路----------------------
你表字段Id不是uniqueidentifier型的吧
------解决思路----------------------
我是08r2,按照您的脚本执行了,没有报错啊~~~
sql server 2008
uniqueidentifier类型字段,
在trigger的inserted中select出来后无法赋值给uniqueidentifier类型变量,
赋值时报错:操作数类型冲突: smallint 与 uniqueidentifier 不兼容。
就像是在inserted中uniqueidentifier 字段被转换为了smallint?
create table tb_test
(
Id uniqueidentifier
)
go
CREATE TRIGGER tr_test_insert
ON tb_test
AFTER INSERT
AS
BEGIN
SET NOCOUNT ON;
declare @Id uniqueidentifier
select @Id=Id from inserted--报错:操作数类型冲突: smallint 与 uniqueidentifier 不兼容
END
go
------解决思路----------------------
你表字段Id不是uniqueidentifier型的吧
------解决思路----------------------
我是08r2,按照您的脚本执行了,没有报错啊~~~