-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
They're not defined in the 'generate-db.sql' file. See #15.
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
data-public/metadata/database/diagrams/migrate-diagrams.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--Requires a "Linked server": https://docs.microsoft.com/en-us/sql/relational-databases/linked-servers/linked-servers-database-engine | ||
--Code from https://stackoverflow.com/questions/527327/how-do-you-migrate-sql-server-database-diagrams-to-another-database | ||
|
||
SELECT [name] | ||
,[principal_id] | ||
,[diagram_id] | ||
,[version] | ||
,[definition] | ||
FROM [BEE\BASS].[NlsLinks].[dbo].[sysdiagrams] | ||
|
||
|
||
|
||
|
||
USE NlsLinks | ||
|
||
DELETE sysDiagrams | ||
WHERE name IN ( | ||
SELECT name FROM [BEE\BASS].[NlsLinks].[dbo].[sysdiagrams] | ||
) | ||
|
||
SET IDENTITY_INSERT sysDiagrams ON | ||
|
||
INSERT sysDiagrams ( | ||
name, | ||
principal_id, | ||
diagram_id, | ||
version, | ||
definition | ||
) | ||
SELECT | ||
name, | ||
principal_id, | ||
diagram_id, | ||
version, | ||
definition | ||
FROM [BEE\BASS].[NlsLinks].[dbo].[sysdiagrams] | ||
|
||
SET IDENTITY_INSERT sysDiagrams OFF |