當我試圖執行此存儲過程它給我不是一個有效的標識符錯誤任何人都可以幫助我嗎?錯誤執行存儲過程
CREATE Proc [dbo].[AddLogtrail]
@cmodule varchar(100),
@caudittype varchar(15),
@ctable varchar(100),
@cfield varchar(100),
@cfieldtype varchar(100),
@coriginalval varchar(100),
@cnewval varchar(100),
@cuser varchar(100),
@creason varchar(100) AS
DECLARE @SQL varchar (400)
set @SQL = 'Insert into AudittrailLog (ddatetime,cmodulename,caudittype,ctablename,cfieldname,cfieldtype,coriginalval,cnewval,cuser,creason) values ' +
'(convert(datetime,GETDATE(),105),'[email protected]+','[email protected]+','[email protected]+','[email protected]+','[email protected]+','[email protected]+','[email protected]+','[email protected]+','[email protected]+')';
PRINT @SQL
Exec @SQL
當你PRINT @SQL,你得到整個查詢或被截斷? –
我得到整個查詢... INSERT INTO AudittrailLog( \t ddatetime ,cmodulename ,caudittype ,ctablename ,cfieldname ,cfieldtype ,coriginalval ,cnewval ,cuser ,creason)值(轉換(日期時間, GETDATE(),105),測試,測試,測試,測試,測試,測試,測試,測試,測試) –