Adding nonclustered index to SQL Server table requires edmx file to update? - linq

In case we have added a nonclustered index to a SQL Server table, do we need to update the .edmx file?

Related

Updating a SQL Server database using Entity Framework is not pulling in new tables

I created a database in Azure and have it working just fine in my project.
I went to extend it today and discovered I'm unable to "Update database" in the .edmx file.
The new table has a PK.
So I created a very based test table and have the same issues with it. This is the table I created:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TestTable]
(
[Id] NVARCHAR(128) NOT NULL,
[Testcolumn] NVARCHAR(256) NOT NULL
);
GO
CREATE UNIQUE NONCLUSTERED INDEX [UserNameIndex]
ON [dbo].[TestTable]([Testcolumn] ASC);
GO
ALTER TABLE [dbo].[TestTable]
ADD CONSTRAINT [PK_dbo.TestTable] PRIMARY KEY CLUSTERED ([Id] ASC);
So again, after creating the table I go into the .edmx and click on update model from database and the new table(s) do not show up in Visual Studio 2017.
Anyone know what could be wrong?
Update:
it gets even weirder. I created a new model and updated from the database and the tables came down. I still can't update the original model though. I don't want the solution to be deleting the model and re-creating it because down the road that is not going to be a good idea.
I had to completely delete the model and recreate it. That was the only thing that fixed it. Nothing to do with the table configuration at all.
EF requires that your table has s Primary key, and that is not the case.

Adding the alter table sciprts and running on SSDT solution

I have an existing SSDT solution and I want to add up the alter table scripts in the solutions and running on the SSDT solution such that the tables are updated according to the scripts?
Example: if I already have a table student with two columns sid and sname and I have a script which add up new column city to the table How can I do this such that table is updated?
So in your live database you have changed it and you want the change to be in SSDT?
If this is the case, do a schema compare with the project as the destination and database as the source - you can choose what to update and it will update the project instead of the database.

SAS DI Studio create index on Oracle table

Is it possible to create an index on a column of an Oracle table registered in metadata of SAS Data Integration Studio? If it is, which type of index is created? Simple one or which one?
yes we can create an index on output table of oracle database.After registering the output table you can find the index tab/keys tab .there we can create index(either it may be simple(for simple the index name and column name should be same) and for composite index you can able to choose multiple columns

Why a primary key automatically creates a clustered index

When i create a primary key in oracle table, why does it create a 'clustered' index by default. What is the reason for this automatic creation of a clustered index on creation of a primary key? is it just the Oracle designer's preference that he designed oracle in this way?
Oracle will create an index to police an unique constraint where no pre-existing index is suitable. Without the index, Oracle would need to serialize operations (such as a table lock) whenever someone tries to insert or delete a row (or update the PK).
Contrarily to MS-SQL Server, this index is not clustered on heap tables (default table organization), i.e. this index won't change the underlying table structure and natural order. The rows won't be reordered when Oracle creates the index. The index will be a B-tree index and will exist as a separate entity where each entry points to a row in the main table.
Oracle doesn't have clustered index as MS SQL, however indexed-organized tables share some properties with cluster-indexed tables. The PK is an integral part of such tables and has to be specified during creation.
(Oracle also has table clusters, but they are a completely different concept).
Creating Index is basic functionality of Primary key, it is also in SQL Server and MySQL, Clustered Index makes your searches faster.
The Database Engine automatically creates a unique index to enforce the uniqueness of the PRIMARY KEY constraint. If a clustered index does not already exist on the table or a nonclustered index is not explicitly specified, a unique, clustered index is created to enforce the PRIMARY KEY constraint.
Read this:
http://www.sqlskills.com/blogs/kimberly/the-clustered-index-debate-continues/

How to convert a temporary table to permanent table in Oracle and vice versa

I would like to know which is the command to convert a temporary table to permanent table in Oracle.
Other issue is about the index. An index used in a temporary table will be the same used in a permanent table, if I convert it?
You can't convert a table from a temporary table to a permanent table.
You can create a new permanent table that matches the structure of the temporary table
CREATE TABLE new_permanent_table
AS
SELECT *
FROM old_temporary_table
WHERE 1=0;
Or you could get the DDL for the temporary table using the DBMS_METADATA package and manually edit the DDL to create the new permanent table.
Then you can create whatever indexes you would like on the new permanent table and drop the old temporary table. Once the old temporary table is dropped, you can rename the permanent table to use the name of the old temporary table if you would like.

Resources