declare @InsertSQL nvarchar(MAX); set @InsertSQL = N'Insert Into dbo.['+@tableName+N'](ParentID,SourceID,NickName,Content,IP,City,BeFiltered,[Disable]) values (@ParentID,@SourceID,@NickName,@Content,@IP,@City,@BeFiltered,@Disable);select @InsertedID = SCOPE_IDENTITY();'; exec sp_executesql @InsertSQL, '@ParentID int,@SourceID int,@NickName nvarchar(20),@Content nvarchar(300),@IP nvarchar(30),@City nvarchar(30),@BeFiltered bit,@Disable bit,@InsertedID int output', @ParentID, @SourceID, @NickName, @Content, @IP, @City, @BeFiltered, @Disable, @InsertedID output;
declare @InsertSQL nvarchar(MAX); set @InsertSQL = N'Insert Into dbo.['+@tableName+N'](ParentID,SourceID,NickName,Content,IP,City,BeFiltered,[Disable]) values (@ParentID,@SourceID,@NickName,@Content,@IP,@City,@BeFiltered,@Disable);select @InsertedID = SCOPE_IDENTITY();'; exec sp_executesql @InsertSQL, N'@ParentID int,@SourceID int,@NickName nvarchar(20),@Content nvarchar(300),@IP nvarchar(30),@City nvarchar(30),@BeFiltered bit,@Disable bit,@InsertedID int output', @ParentID, @SourceID, @NickName, @Content, @IP, @City, @BeFiltered, @Disable, @InsertedID output;
已经修正错误
你在创建过程的时候并没有给他输入参数,为什么你在执行的时候会给它输入参数呢?