CREATE PROCEDURE  [getzijin] @date datetime,@username varchar(50) AS
set nocount on
begin transaction
insert TABLE (username,name,shl) select @username,pzhhh,sum(jc) from DATABASE.TABLE1 where date=@date group by pzhhh having sum(jc)<>0
commit
GODATABASE.TABLE1 是另外一个数据库DATABASE的TABLE1表提示DATABASE.TABLE1无效,请问该如何写啊 ,谢谢

解决方案 »

  1.   

    DATABASE..TABLE1  or  DATABASE.dbo.TABLE1 
      

  2.   

    CREATE PROCEDURE  [getzijin] @date datetime,@username varchar(50) AS 
    set nocount on 
    begin transaction 
    insert TABLE (username,name,shl) select @username,pzhhh,sum(jc) from DATABASE.dbo.TABLE1 where date=@date group by pzhhh having sum(jc) <>0 
    commit 
    GO 
      

  3.   

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