|
Execute the following
script in Query Editor to demonstrate the use of DEFAULT VALUES for completely defaulted table:
USE tempdb
GO
CREATE TABLE RandomOld (UniqueID uniqueidentifier DEFAULT NewID(), CreateDate smalldatetime DEFAULT getdate())
CREATE TABLE RandomSequentialNew (UniqueID uniqueidentifier DEFAULT NewSequentialID(), CreateDate smalldatetime DEFAULT getdate())
CREATE TABLE RandomSequentialNew1 (UniqueID uniqueidentifier DEFAULT NewSequentialID(), CreateDate smalldatetime DEFAULT getdate())
INSERT INTO RandomOld DEFAULT VALUES
INSERT INTO RandomOld DEFAULT VALUES
INSERT INTO RandomOld DEFAULT VALUES
INSERT INTO RandomOld DEFAULT VALUES
INSERT INTO RandomSequentialNew DEFAULT VALUES
INSERT INTO RandomSequentialNew DEFAULT VALUES
INSERT INTO RandomSequentialNew DEFAULT VALUES
INSERT INTO RandomSequentialNew DEFAULT VALUES
INSERT INTO RandomSequentialNew1 DEFAULT VALUES
INSERT INTO RandomSequentialNew1 DEFAULT VALUES
INSERT INTO RandomSequentialNew1 DEFAULT VALUES
INSERT INTO RandomSequentialNew1 DEFAULT VALUES
SELECT UniqueID, BinaryValue=CONVERT(binary(16), UniqueID), CreateDate
FROM RandomOld
SELECT UniqueID, BinaryValue=CONVERT(binary(16), UniqueID), CreateDate
FROM RandomSequentialNew
SELECT UniqueID, BinaryValue=CONVERT(binary(16), UniqueID), CreateDate
FROM RandomSequentialNew1
GO
DROP TABLE RandomOld
GO
DROP TABLE RandomSequentialNew
GO
DROP TABLE RandomSequentialNew1
GO
|