Using SSDT in VS2012 I have created a number of synonyms from a reporting db to a transactional db.
When viewing the schema view - the synonyms appear under the tables subdir, with the SQLCMD variables as part of the table name.
I can kind-of understand the logic of this, however it does pollute the layout and makes it harder to find the tables I'm looking for?
nb. I cant expand any of these tables (ie they dont show the columns of the synonym) and there is no option to delete (right click only gives Refresh and properties)
Hmmm... Looking further at this it seems there are more issues with the schema view. The image below shows the views of the reference database. (there is no actual reference to these views in the database itself) - it also shows the views of the Master Database (which is also a db reference in the project?)
Related
We created several views postgresql 12 (not materialized views) which include nested queries and multiple joins.
we are facing a strange behavior, are noticing that some views are disappearing from the view list and others are remaining. is this related to Database configuration.
Are we missing some configuration?
I can only guess, but the one way that views can disappear is if you DROP them. You'd probably remember if you dropped them directly, but you can drop them indirectly with
DROP TABLE some_table CASCADE;
If you do that, all views and materialized views that depend on that table are dropped as well.
We didn't drop the tables directly, however since we are using ESRI ArcGIS Desktop to manage our GIS data which is hosted on a PostgreSQL database. we identified the cause of the issue after the admin replaced all the tables in the schema. and ArcGIS Desktop dropped the tables and deleting the views without informing the admin.
I am very new to EA and in general data engineering. I want to be able syncronize my MS SQL DB with the data model I created in EA. Using the help and tutorials, I learnt how to push my data model onto the MS SQL DB. What I fail to achieve is the syncronization. I have a feeling that is has to do with the schema. The database builder lists all the orginal tables and then again all tables from the ODBC connection with an additional 'dbo.'
Do i need to define this somwhere in the options of my data model or can I compare the data model with the server taking account of the schema?
You need to work in the “Database Builder” feature of Sparx EA.
This can be found on the "Develop" tab. (This will not work directly from the “Browser”)
Select the package having the “Database” as its stereotype. Use mouse button 2 and select “Manage DBMS Options”. The dialog will enable you to change the table(s) owner or even change the selected DBMS type. From the database builder you can then perform the "database compare" or "compare with options".
Note regarding terminology - the "dbo" in SQL Server is a the database owner.
(I have also posted this answer to the Sparx Forum.)
You can find the related documentation with screen images here: https://www.sparxsystems.com/enterprise_architect_user_guide/15.2/model_domains/import_schema_into_builder.html
I needed to add the owner tag dbo to all my tables. For some reson it was not enough to add it to the data model object. Thanks to this thread i found an option to change it for all tables at once.
How do you set the database schema, at the package level, in SPARX Enterprise Architect?
There were still some differences about the PK and FK ids when i tried to compare but I just aligned my local data model with that and now there are no differences between the data model and the data base.
We are using SQL Server Data Tools (SSDT) to manage our customer databases.
In theory all databases are identical, but in practice we have a few stored procedures (and one trigger) that would change from one customer to another.
We created a main SSDT for everything common, and then one SSDT per customer containing only the specific stored procedures (no tables).
In the specific SSDTs we get warnings because SSDT can't find the tables referred in the stored procedures, but we can live with that (obviously SSDT won't be able to validate the table's fields since it can't find the table). For the trigger, we get an error (table can't be found), thus the database project doesn't compile.
How should we manage that? I guess we should not be alone in this situation.
Is there a way for a database project to refer objects (tables) from another database project ?
Thanks,
Yves Forget
Daniel N gave the right direction, I'll just explain. Let's say you have database project named DatabaseA which will contain the only objects that 100% match for every customer. Then you create another database project DatabaseB and include DatabaseA as "the same instance, the same database". In database DatabaseB you can add customer specific objects. Then you can create other database for other customer in a similar way.
IN SSDT you can add another database project or dacpac as a reference.
In the properties for the referenced project you will be able to set where the referenced database resides, same server same database, same server diff database etc
https://msdn.microsoft.com/en-us/library/jj684584%28v=vs.103%29.aspx?f=255&MSPPError=-2147217396
I am attempting to create an indexed view on SQL Server 2008. I have a master database in which I cannot make any changes to (in terms of adding tables, views, etc.). However, I need to create some different views for various reasons that need to work with live data.
I have created a new database along side my master database so I can create views there. I am able to create views just fine, but I want to index some of the larger views. However, when I try to create a schema bound view cross-database, I receive the following error:
Cannot schema bind view 'dbo.Divisions' because name
'master.dbo.hbs_fsdv' is invalid for schema binding. Names must be in
two-part format and an object cannot reference itself.
Since I am going cross-database with the views, I have to reference the name in three-part format.
My creation statement for the view:
CREATE VIEW dbo.Divisions WITH SCHEMABINDING AS
SELECT master.dbo.hbs_fsdv.seq_ AS DivisionID,
master.dbo.hbs_fsdv.fs_division_desc_ AS Description
FROM master.dbo.hbs_fsdv
How can I create an indexed cross-database view in SQL Server?
Plain and simple. You can't. From the MSDN page:
The view must reference only base tables that are in the same database as the view.
https://msdn.microsoft.com/en-us/library/ms191432.aspx
Although (per the docs) it cannot be done directly with a simple SQL statement, this use case is very common and has a solution.
The architecture would have to involve caching the remote tables into your centralized database, and building the indexed view on top of them.
Some good notes on this can be found here:
What is the best way to cache a table from a (SQL) linked server view?
and
https://thomaslarock.com/2013/05/top-3-performance-killers-for-linked-server-queries/
I’m after a bit of advice on the best way to go about this is SQL server 2008R2 express. I have a number of applications that are in separate databases on the same server. They are all “plugins” that use a central staff/structure list that will be in a separate database. The application is in the process of being migrated from JET.
What I’m looking for is the best way of all the “plugin” databases being able to see the central database and use those tables in standard queries and views etc.
As I’m using express that rules out any replication solution and so far the only option I can think of is to use triggers or a stored procedure to “push” out all the changes to the plugins. The information needs to be populated on a near enough real time basis however the number of changes will be very small maybe up to 100 a day and the biggest table only has about 1000 rows at the moment (the staff names table).
Hopefully that will cover all everything but if anyone needs any more details then just ask
Thanks
Apologies if I've misunderstood, but from your description it sounds like all these databases are hosted on the same instance of SQL Server - it's your mention of replication that makes me uncertain.
Assuming that's the case, you should be able to replace any copies of tables from the central database which are held in the "plugin" databases with views or synonyms which reference the central tables directly, since SQL server allows you to make references between databases on the same server using three-part naming (database_name.schema_name.object_name)
For example, if each plugin db has a table StaffNames, you could replace this with a view by dropping the table, then creating a view:
drop table StaffNames
go
create view StaffNames
as
select * from <centraldbname>.<schema - probably dbo>.StaffNames
go
and your code should continue to work seamlessly, as long as permissions are set up.
Alternatively, you could replace all the references to the shared tables in the plugin databases with three-part name references to the central database, but the view method requires less work.