我的TRIGGER遇到了一些问题:
CREATE TRIGGER "tblSettingTable_INSERT"
ON dbo.tblSettingTable
FOR INSERT
AS
INSERT INTO dbo.tblSettingReportParameter (tableName, columnName, columnCaption)
SELECT tableName = CAST(OBJECT_NAME(c.object_id) AS varchar(100)),
columnName = CAST(c.name AS varchar(100)),
columnCaption = CAST(ex.value AS varchar(100))
FROM sys.columns c
LEFT OUTER JOIN sys.extended_properties ex
ON ex.major_id = c.object_id
AND ex.minor_id = c.column_id
AND ex.name = 'MS_Caption'
INNER JOIN inserted ON OBJECT_NAME(c.object_id) = inserted.tableName
WHERE OBJECTPROPERTY(c.object_id, 'IsMsShipped')=0
AND OBJECT_NAME(c.object_id) = inserted.tableName
我正在尝试从表中获取一些列属性并将其插入到dbo.tblSettingReportParameter
但是我把它抛到了我的脸上:“键列信息不足或不正确。太多行受到了影响更新“。
我做错了什么?使用MS-SQL 2008 RS。
谢谢,
的Stefan
答案 0 :(得分:7)
如果您向触发器添加SET NOCOUNT ON
,则应该修复。
xx rows returned
令人困惑的Access(我假设根据问题的标签向INS Server发出INSERT)