SQL Server View Primary Key

Is there any way to give a view of the primary key in sql server. I know this is possible in oracle.

I'm not worried about updating its read-only view, but someone is using it in ms access, so I would like a constraint that I know to be correct to be shown.

+6
sql sql-server tsql sql-server-2005
source share
3 answers

Yes, you can create an indexed index that must have a primary key. Note that this will save the presentation data to disk, which may or may not be what you are looking for.

In addition, creating indexed views can also affect performance, both positively and negatively. Before implementation, make sure that you carefully study the pros, cons, and limitations.

+11
source share

An indexed view is the right choice, but the primary key, as RedFilter said, is actually not required . Although there are many requirements that you will be forced to have, for example, a clustered index.

0
source share

Inside MS Access you can create a primary key in a related form using the SQL statement:

 ALTER TABLE [TableName] ADD CONSTRAINT [PrimaryKeyName] PRIMARY KEY ([FieldName1, FieldName2, ...]) 

However, using Indexed View is the best solution.

0
source share

All Articles