Forum Discussion
mikeburek
7 months agoAdvocate III
How to restore / migrate / copy the stored procedures and view across / to another workspaces?
I want to copy the stored procedures from a Fabric SQL database in one workspace to another workspace. The only options I see are: * Move to another folder within the same workspace * Restore t...
- 6 months ago
There is no solution to do this within Fabric at this time.
There are workarounds with external tools, and some of those methods are the same as a plain SQL Server database.
The reply from deborshi_nag is the closest to how to do it in a Fabric method.
deborshi_nag
7 months agoSuper User
Hello mikeburek
SQL stored procedures can be version-controlled in GitHub and deployed across different databases, but there are a few considerations:
How It Works
Store Procedures as Scripts
- You export the stored procedure definitions as .sql files (e.g., CreateProcedure.sql).
- These files can be committed to a GitHub repository like any other code.
Version Control Benefits
- GitHub tracks changes, enabling collaboration, rollback, and auditing.
- You can use branches for development, testing, and production environments.
Moving Between Databases
- To deploy to another database, you run the .sql scripts against the target database using tools like:
- SQL Server Management Studio (SSMS) or Azure Data Studio
- Command-line tools (sqlcmd)
- CI/CD pipelines (e.g., Azure DevOps, GitHub Actions) for automated deployment.
- To deploy to another database, you run the .sql scripts against the target database using tools like:
Best Practices
- Parameterise database names or use environment-specific configuration files.
- Include DROP/CREATE or ALTER statements in scripts for idempotency.
Hope this helps - please appreciate by leaving a Kudos or accepting as a Solution!