Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
In relational database design, a primary key can uniquely identify each row in a table. A primary key comprises a single column or a set of columns.
2
votes
Accepted
How to alter primary key constraint for 2 columns in same table in SQL Server?
Don't enter this into the check constraint dialogue box. That only allows you to enter expressions for check constraints.
To create your primary key constraint you should just execute your TSQL ALTER …
13
votes
Accepted
Sort order specified in primary key, yet sorting is executed on SELECT
For a non partitioned table I get the following plan
There is a single seek predicate on Seek Keys[1]: Prefix: DeviceId, SensorId = (3819, 53), Start: Date < 1339225010.
Meaning that SQL Server c …
7
votes
Accepted
Incorrect uniqueidentifier works without a Primary Key but fails with one
I was able to repro this.
Both plans had the row from #temptable driving a nested loops join.
When #DatabaseTable has a primary key there is an index to seek into so the inside of the join has a see …
7
votes
Accepted
Should I add an auto-increment / IDENTITY field to a cross-reference table just for PK purpo...
For a non-unique clustered index on comany_id alone, SQL Server will automatically add a 4 byte integer uniqueifier to all duplicate (i.e. second and subsequent for a key value) clustered index keys t …
5
votes
Accepted
Shorthand for on primary key?
No there isn't anything similar to what you are asking built into the product.
Standard SQL has the concept of a NATURAL JOIN that joins on common column names but SQL Server does not implement this …
3
votes
Accepted
No Primary Key in some sql server tables
You can run the following query to see the tables with no primary key.
SELECT [schema] = SCHEMA_NAME(schema_id),
name,
temporal_type_desc
FROM sys.tables
WHERE object_id NOT IN (SELE …
4
votes
How can an identity primary key index become fragmented?
Logical fragmentation occurs when the logically next page is different from the physically next page.
In the case of the leaf level of an index with a monotonically increasing key this can happen if …
7
votes
Reset Key Names to Defaults?
There's no way to do this automatically but you can query the catalogue views to find constraint names not in the desired pattern then generate the desired script that way.
Something like
DECLARE @S …