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:
If the database is in another server, specify the linked server name too:
Schema name – replace by your schema which is “dbo” by default in sql server.