日期:2014-05-17 浏览次数:20663 次
insert into tb_vmember (c_vclass,c_vname,c_vtext) values (N'???úíá?',N'測試102',N'???úíá?')
--這個是insert數據到varchar數據庫表//
ALTER TRIGGER [dbo].[insVToNv]
ON [dbo].[tb_vmember]
FOR INSERT
AS
BEGIN
if TRIGGER_NESTLEVEL()>1
return
insert into [DBNVarchar].[dbo].[tb_member](c_name,c_class,c_text)
select tbv.c_vname,tbv.c_vclass,tbv.c_vtext
from tb_vmember tbv,inserted i
where tbv.c_id=i.c_id
END
--這個是varchar類型數據庫tb_vmember的觸發器
if object_id('[TB]') is not null drop table [TB]
go
create table [TB] (cn nvarchar(14),c nvarchar(18))
insert into [TB]
select N'???úíá?','jlsdkfjsd'
select * from [TB]
INSERT INTO TB(c)
SELECT '???úíá?' --插入到varchar 中的非unicode字符,就已经是???úíá?了。触发器处理后也无法再nvarchar显示正常
INSERT INTO TB(cn)
SELECT c
FROM dbo.TB
WHERE c = '???úíá?'
/*
cn c
???úíá? jlsdkfjsd
NULL ???úíá?
???úíá? NULL*/