Hi Again,
I need to drop a table and create a new one on a trigger.
CREATE TRIGGER TBL_DEL ON dbo.PeerFileListCollection
FOR DELETE
AS
DECLARE @RecordRemoved nvarchar(10)
Declare @TableName nvarchar(10)
declare @SQL nvarchar(100)
Select @RecordRemoved = (Select PeerID From deleted)
set @SQL = ' DROP TABLE ' + 'dbo.'+ltrim(@RecordRemoved)
EXEC(@SQL)
I am using the above code to delete a table, but it is throwing an error. I have tried without "dbo." as well. Still the same.
Thanks in advance
Mal.
I need to drop a table and create a new one on a trigger.
CREATE TRIGGER TBL_DEL ON dbo.PeerFileListCollection
FOR DELETE
AS
DECLARE @RecordRemoved nvarchar(10)
Declare @TableName nvarchar(10)
declare @SQL nvarchar(100)
Select @RecordRemoved = (Select PeerID From deleted)
set @SQL = ' DROP TABLE ' + 'dbo.'+ltrim(@RecordRemoved)
EXEC(@SQL)
I am using the above code to delete a table, but it is throwing an error. I have tried without "dbo." as well. Still the same.
Thanks in advance
Mal.