sql server - Using stored procedures of another database -
I have The tables I want to fill in are in I do not want to add stored procedures in the same database of tables ( This is one of the procedures stored in DB1 and here is where I execute the stored procedure I: and it gives me an error: You can reference SQL Server tables with one: A different database You only need the last three parts: You can use it in a stored procedure to insert a table into a separate database. database1 There are some procedures in the I / code> statement.
database2 . How can I write a question with
EXEC procedures to fill those tables?
database2 )
USE [database1] Go SET ANSI_NULLS Go set to go change process QUOTED_IDENTIFIER [dbo] [Subject] ([code], [credit], [hour] value (@medical code) [subject ] [Subject] ([code], [credit], [code], @ credits, @horse] @@ identity
EXEC @ subid = [database1]. [DBO]. [Add topic] @icicode = '1234', @ credit = 2, @ hours = 50
Message 208 , Level 16, State 1, Process AddSubject, Line 14 Invalid Object Name 'database2.dbo.Subject'
server.database.schema.table
Insert other db.dbo.yourtable (Col1, col2, ...) values ('val1', 'val2', ... )
Comments
Post a Comment