Referencing two database projects (same database) containing the same objects will unexpectedly build - sql-server-data-tools

I have a Comp1 project that has a schema definition ("tmp") and a table definition:
Then I create a Main project that has the same definition of [tmp].[table1]. If I create a "same database" reference from the Main project to the Comp1, I get the expected error of "The model already has an element that has the same name...":
Now, if I create a new Comp2 project and a Schema "one" and create the "same database" relations as following, I expected the same error for the table table1 and the schema "tmp" in the Main project. But I get a successful building:
Am I missing something?

Related

Find unused labels

Is there any way I can find labels which are not used in D365 FO (labels which dont have references)?
The cross references are stored in database DYNAMICSXREFDB. You can use a sql query to generate a list of labels that have no references.
This query uses two tables in the database:
Names holds an entry for each object in the application that can be referenced.
The Path field of the table holds the name of the object (e.g. /Labels/#FormRunConfiguration:ViewDefaultLabel is the path of the ViewDefaultLabel in the FormRunConfiguration label file.
Field Id is used to reference a record in this table in other tables.
References holds the actual references that connect the objects.
Field SourceId contains the Id of the Names record of the object that references another object identified by field TargetId.
The actual query could look like this:
SELECT LabelObjects.Path AS UnusedLabel
FROM [dbo].[Names] AS LabelObjects
WHERE LabelObjects.Path LIKE '/Labels/%'
AND NOT EXISTS
(SELECT *
FROM [dbo].[References] AS LabelReferences
WHERE LabelReferences.TargetId = LabelObjects.Id)
Make sure to compile the application to update the cross reference data. Otherwise the query might give you wrong results. When I run this query on a version 10.0.3 PU27 environment, it returns one standard label as a result.

EDMX and bridge table using oracle database

I have an oracle database connected to ASP.net MVC 5 with entity framework 6 application, all things was going well, until i made a change (add a new column) in bridge table:
the table:
my constraint on table :
Sample of data:
Error::
Severity Code Description Project File Line Suppression State
Error Error 3025: Problem in mapping fragments starting at line 4758:Must specify mapping for all key properties (DECC_TAB_SUB.TAB_ID, DECC_TAB_SUB.PARENT_TAB_ID, DECC_TAB_SUB.STEPROLE_ID) of table DECC_TAB_SUB. DECC.EntityModel
and here's the table in diagram
and here's the association
, I have made many searches but unfortunately i didn't find anything helps me.

How to create Indexes with SSDT

Creating a SQL Function in SSDT works smoothly. When I modify the function's SQL, I can generate the DACPAC, then publish the DACPAC and the database is automatically updated. My function SQL looks like:
CREATE FUNCTION [dbo].[foo]
(
...
)
RETURNS int
AS
BEGIN
...
END
This is a file called foo.sql with build action to Build.
When I need to add a database index, I add an Index file to my project and put in:
CREATE NONCLUSTERED INDEX [idxFoo]
ON [dbo].[tblFoo] ([id])
INCLUDE ([fooVal])
If I try to build it I get several SQL71501 errors.
I was forced to add all Indexes in a common file set to PostDeploy.
I have found numerous references to including a DACPAC reference to the project-which I did. This works for most items, but not Indexes. I have no idea why.
I needed to add Table definitions to the project of the "missing" referenced objects in the Indexes. In order to get the script to create the tables, I used the VS Sql Server Object Explorer. Right click on table and select View Code (includes the table's existing Indexes and other elements). NOT Script As->(table create sql only) If you don't SQLPackage.exe will delete the Indexes not defined in your project.
Please ensure that all referenced objects are defined in the project.
The definition of all referenced objects must be present in your database project. This is because the database project is intended to represent the database schema as a valid stand-alone entity. Having this allows the tools to verify that your objects are correct -- i.e. that any references contained in them refer to objects that exist.

Tsqlt with XML Schema collection

I am currently working on a table schema that has a column that refers to an XML schema collection. After faking the table in my unit test and running the test I got an error message: 'Collection specified does not exist in metadata'.
I have tried to create xml schema collection before faking. but this still causes an error.
Anyone have idea.
Thanks in advance!

Entity framework error "Invaid column name" while update record after renaming table

I am using asp.net 4.5 with EF to add/update/delete record.
I renamed a database table StatusMaster to Status.
To reflect this change in entity, I have used "update model from database" in which I have deleted the table first.
Then I have deleted the table from the diagram using "Delete Model".
Then I added table to the edmx file using "Update Model from Database".
I also have update related code in application.
Now Add() method is working well but while update method it gives me error "Invalid column name 'Id'". This column was the primary key before I update but I have also renamed it to "StatusId" but I don't think it should affect it because I already have deleted and added the table using "Update model from database".
Please help me.
All the more reason I prefer code first. More work to set up but easier to make changes down the line. Ill suggest you do the following.
Delete the entire EDMX
Delete Connection Details from config section in Web.config
Re-Create EDMX
I discovered that is faster that trying to debug ur relationship in the EDMX diagram

Resources