How to Use the Timestamp Data Type in SQL Server Express
- 1). Click "Start" and navigate to "All Programs" and "SQL Server version_#" where version_# is your version of SQL Server Express.
- 2). Click the "SQL Server Management Studio" icon.
- 3). Select the database server desired from the "Server name" drop-down.
- 4). Select "Windows Authentication" from the "Authentication" drop-down.
- 5). Click the "Connect" button.
- 1). Click the desired database where you want to create the table in the "Object Explorer."
- 2). Click the "New Query" button on the Standard toolbar.
- 3). Type the following in the query editor:
"CREATE TABLE [dbo].[CurrentUsers](
[UserID] [int] NOT NULL,
[UserName] [nvarchar](50) NOT NULL,
[RecVersion] [timestamp] NOT NULL,
CONSTRAINT [PK_CurrentUsers] PRIMARY KEY CLUSTERED ([UserID] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY])
ON [PRIMARY]" - 4). Click the "Execute" button on the SQL Editor toolbar or press "F5" on the keyboard.
- 1). Click the "New Query" button on the Standard toolbar.
- 2). Type the following code:
INSERT INTO [dbo].[CurrentUsers]
([UserID]
,[UserName])
VALUES
(1
,'John Smith')
GO
SELECT * FROM Compare - 3). Click the "Execute" button on the SQL Editor toolbar or press "F5" on the keyboard.
- 4). The system will return results similar to the following:
"1 John Smith 0x0000000000000FA1"