在开发asp.net web 应用的时候,在sqlserver2005 有两个库,lib1,lib2。在lib1中有表 tbl, 在lib2中有存储过程,其中语句select * from lib1.dbo.tbl where contains( col1, @key)运行时提示错误,"过程tbl的请求失败,因为tbl 是 表 对象 "。请问怎么解决?因为tbl是很大一个表,并且有索引,不想copy 到lib2中。 目前两个库在同一台服务器上。

解决方案 »

  1.   

    col1, @key 与另一个数据库有关吗?
      

  2.   

    col1是lib1.tbl的一个列名, @key是条件,输入参数
      

  3.   


    select * from lib1.dbo..tbl where contains( col1, @key) //调用别的库 库名..表名
      

  4.   

    这两个数据库似乎没关系啊!
    用 一个数据库中的 col1 与 @key 是否存在包含关系,去到另一个数据库中查找是否有满足条件的记录?逻辑上讲得通吗?
      

  5.   


    use master
    Create table a (a int)
    insert into a select 1use test
    Create table a (a int)
    insert into a select 1use master
    select * from test..a
    --1
      

  6.   

    猜,你是不是想要实现这个意思:select * from lib1.dbo..tbl where lib1.dbo..tb1.col1=col1 and contains( col1, @key)