0

How can I using only mysql commands create a copy of a procedure on targetDB from sourceDB? For example, the following code copies a table from SourceDB to TargetDB:

CREATE TABLE targetDB.table1 like sourceDB.table2;
INSERT INTO targetDB.table1 SELECT * FROM DB1.table1 ;

I'd like to create code that accomplishes the same thing with Views and Procedures from sourceDB to targetDB.

For views I've tried this, however I'm unsure of whether the view retains the definition/data from the source:

CREATE VIEW targetDB.view1 as SELECT * FROM sourceDB.view1;

I've tried similar things for procedures

CREATE PROCEDURE targetDB.proc1 as SELECT * from sourceDB.proc1;"

Note: I do not have access to SQL Server Management Studio for the mysql server I am working with

Shadow
  • 33,525
  • 10
  • 51
  • 64
AmateurPCB
  • 33
  • 1
  • 6
  • Management Studio is just for SQL Server, it can't connect to MySQL. – Alejandro Dec 14 '20 at 21:22
  • I thought to mention it only because many solutions I found to my problem have suggested to use scripts which can be created using Management Studio, which is not an option for me. – AmateurPCB Dec 14 '20 at 21:53
  • So if you do not have access possibly you do not have permission as well. – Useme Alehosaini Dec 14 '20 at 21:55
  • Is it an application that its db is open? – Useme Alehosaini Dec 14 '20 at 21:55
  • Are you able to develop an app like c# to do it as an alternative for management UI? – Useme Alehosaini Dec 14 '20 at 21:56
  • I am not sure about developing an application in c# to do this for me. I believe I have suffiecient permissions to this, I want to figure out the commands I'd use for copying procedures and views so I can add additional functionality to a script I am creating which I currently can run remotely through mysql commandline interface – AmateurPCB Dec 14 '20 at 22:35

0 Answers0