schemas.sql 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. if not exists(select s.schema_id from sys.schemas s where s.name = 'audev_carit')
  2. and exists(select p.principal_id from sys.database_principals p where p.name = 'dbo') begin
  3. exec sp_executesql N'create schema [audev_carit] authorization [dbo]'
  4. end
  5. if not exists(select s.schema_id from sys.schemas s where s.name = 'carlo')
  6. and exists(select p.principal_id from sys.database_principals p where p.name = 'dbo') begin
  7. exec sp_executesql N'create schema [carlo] authorization [dbo]'
  8. end
  9. if not exists(select s.schema_id from sys.schemas s where s.name = 'data')
  10. and exists(select p.principal_id from sys.database_principals p where p.name = 'dbo') begin
  11. exec sp_executesql N'create schema [data] authorization [dbo]'
  12. end
  13. if not exists(select s.schema_id from sys.schemas s where s.name = 'locosoft')
  14. and exists(select p.principal_id from sys.database_principals p where p.name = 'dbo') begin
  15. exec sp_executesql N'create schema [locosoft] authorization [dbo]'
  16. end
  17. if not exists(select s.schema_id from sys.schemas s where s.name = 'navision')
  18. and exists(select p.principal_id from sys.database_principals p where p.name = 'dbo') begin
  19. exec sp_executesql N'create schema [navision] authorization [dbo]'
  20. end
  21. if not exists(select s.schema_id from sys.schemas s where s.name = 'optima')
  22. and exists(select p.principal_id from sys.database_principals p where p.name = 'dbo') begin
  23. exec sp_executesql N'create schema [optima] authorization [dbo]'
  24. end
  25. GO