I have to transport some tables(16 tables) to another database and there are a number of stored procedures(200 tables) which use these tables.
Transporting stored procedures to another database is not preferred.
For my case:
dbA
contains sp_xyz
stored procedure, tableB
and tableC
tables.
and content of sp_xyz
can be :
SELECT A.column1, B.column2
FROM
tableB A
JOIN tableC B ON A.fk_b_id = B.id
we want to transport tableC
to dbB. So how should I change this sp with minimum change.
If you want to use a table in another database then you can do like this in sql server when the database is on same server:
Select * from [DBName].[Schema].[Table]
If the database is in another server, specify the linked server name too:
Select * from [DBServer].[DBName].[Schema].[Table]
Schema name - replace by your schema which is "dbo" by default in sql server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With