日期:2014-05-17 浏览次数:20523 次
CREATE TABLE P_PEInfo(
PE_OCNO nvarchar(50) primary key
)
CREATE TABLE P_PEMenu(
ID nvarchar(30) primary key,
Name nvarchar(50),
)
CREATE TRIGGER TRIGGER_PE_INFOMENU
ON PE_PEMenu
AFTER INSERT
AS
DECLARE @ID NVARCHAR(30)
BEGIN
set @ID = inserted.ID
ALTER table P_PEInfo ADD @ID NVARCHAR(30)
END
CREATE TRIGGER TRIGGER_PE_INFOMENU
ON P_PEMenu
AFTER INSERT
AS
DECLARE @ID NVARCHAR(30)
BEGIN
select @ID =ID FROM inserted
EXEC('ALTER table P_PEInfo ADD '+@ID +' NVARCHAR(30)')
END
INSERT INTO P_PEMenu(id,name)
SELECT N'test',N'123'
SELECT * FROM P_PEInfo