--- pls try:CREATE procedure tritest
as
if (object_id('tri') is null)
begin
create table tri (a int ,b int ,c int)
exec('create trigger yourTri on tri for insert
as
update tri
set c=a*b
where c is null ')
end
GO
as
if (object_id('tri') is null)
begin
create table tri (a int ,b int ,c int)
exec('create trigger yourTri on tri for insert
as
update tri
set c=a*b
where c is null ')
end
GO
所以不能在PORCEDURE裡直接CREATE TRIGGER上面的方法是用動態執行的方法,可以解決這個問題
我已經做過測試!
如果是2003-01-23这样的我一般就定义哪个字段为CHAR(10),往里写数据时将DATETIME型的转换一下