declare @indextable table(id int identity(1,1),nid int)
select @Countrows=count(ID) from Article where deleted=0 and Content like '%'+@keyword+'%'
insert into @indextable(nid) 
“insert into @indextable(nid)”表示什么意思?

解决方案 »

  1.   

    declare @indextable table(id int identity(1,1),nid int)
    select @Countrows=count(ID) from Article where deleted=0 and Content like '%'+@keyword+'%'
    insert into @indextable(nid) 
    “insert into @indextable(nid)”表示什么意思?
      

  2.   

    这个似乎是要定义一个临时表,但是语法好像有误。一般是#indextable
      

  3.   

    没有错误,@indextable是mssql中的表变量啊内存中的临时表
      

  4.   

    形式上和#开头的那种临时表没什么区别只不过一个是在内存,另一个是写在硬盘里参考sqlserver联机帮助中的"表变量":尽可能使用表变量而不使用临时表。table 变量有以下优点: table 变量的行为类似于局部变量,有明确定义的作用域。该作用域为声明该变量的函数、存储过程或批处理。 
    在其作用域内,table 变量可像常规表那样使用。该变量可应用于 SELECT、INSERT、UPDATE 和 DELETE 语句中用到表或表的表达式的地方。在存储过程中使用表变量与使用临时表相比,减少了存储过程的重新编译量。涉及表变量的事务只在表变量更新期间存在。这样就减少了表变量对锁定和记录资源的需求。 
    不支持在表变量之间进行赋值操作。另外,由于表变量作用域有限,并且不是持久数据库的一部分,因而不受事务回滚的影响。