Skip to main content
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
Results tagged with
Search options answers only not deleted user 1192

Data Definition Language; defining database structures but not their contents.

11 votes
Accepted

How to create a partitioned table based on date?

As the error message says, any partition-aligned unique index has to include the partitioning key in the index key. This requirement exists so the engine can enforce uniqueness on updates without che …
Paul White's user avatar
  • 90.2k
17 votes
Accepted

Does SQL Server allow (make visible) DDL inside a transaction to the transaction prior to co...

Common workarounds involve dynamic code (as in Joe's answer), or separating the DML and DDL into separate batches. … With regard to SQL Server, there is a school of thought that says mixing DDL and DML in a transaction is not a great idea. …
Paul White's user avatar
  • 90.2k
5 votes

What effect does serializable isolation level have on DDL-statements?

I know what it does to dml-statements, but I'm not sure what it means for ddl. Generally speaking, not much. … DDL encompasses a huge range of operations (many of which have their own special behaviours), but most DDL will take a schema modification (Sch-M) lock on the underlying object, either for the duration …
Paul White's user avatar
  • 90.2k
9 votes
Accepted

SQL Server Concurrent Inserts and Deletes

The UPDLOCK, SERIALIZABLE pattern is all about avoiding incorrect results (including false key violation errors) due to race conditions, when performing a particularly common operation known as an UPS …
Paul White's user avatar
  • 90.2k
6 votes

Constraint to enforce "at least one" or "exactly one" in a database

If you can add a column to the table, the following scheme would almost1 work: CREATE TABLE emails ( UserID integer NOT NULL, EmailAddress varchar(254) NOT NULL, IsActive boolean NOT NUL …
Paul White's user avatar
  • 90.2k