schemas.sql 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. if not exists(select s.schema_id from sys.schemas s where s.name = 'xtract')
  2. and exists(select p.principal_id from sys.database_principals p where p.name = 'dbo') begin
  3. exec sp_executesql N'create schema [xtract] authorization [dbo]'
  4. end
  5. if not exists(select s.schema_id from sys.schemas s where s.name = 'transform')
  6. and exists(select p.principal_id from sys.database_principals p where p.name = 'dbo') begin
  7. exec sp_executesql N'create schema [transform] authorization [dbo]'
  8. end
  9. if not exists(select s.schema_id from sys.schemas s where s.name = 'load')
  10. and exists(select p.principal_id from sys.database_principals p where p.name = 'dbo') begin
  11. exec sp_executesql N'create schema [load] authorization [dbo]'
  12. end
  13. if not exists(select s.schema_id from sys.schemas s where s.name = 'data')
  14. and exists(select p.principal_id from sys.database_principals p where p.name = 'dbo') begin
  15. exec sp_executesql N'create schema [data] authorization [dbo]'
  16. end
  17. if not exists(select s.schema_id from sys.schemas s where s.name = 'transform_ims')
  18. and exists(select p.principal_id from sys.database_principals p where p.name = 'dbo') begin
  19. exec sp_executesql N'create schema [transform_ims] authorization [dbo]'
  20. end
  21. if not exists(select s.schema_id from sys.schemas s where s.name = 'transform_imr')
  22. and exists(select p.principal_id from sys.database_principals p where p.name = 'dbo') begin
  23. exec sp_executesql N'create schema [transform_imr] authorization [dbo]'
  24. end
  25. if not exists(select s.schema_id from sys.schemas s where s.name = 'test')
  26. and exists(select p.principal_id from sys.database_principals p where p.name = 'dbo') begin
  27. exec sp_executesql N'create schema [test] authorization [dbo]'
  28. end
  29. if not exists(select s.schema_id from sys.schemas s where s.name = 'test_systemvergleich')
  30. and exists(select p.principal_id from sys.database_principals p where p.name = 'dbo') begin
  31. exec sp_executesql N'create schema [test_systemvergleich] authorization [dbo]'
  32. end
  33. GO