RIP
Tutorial
Tags
Topics
Examples
eBooks
Tutorial by Examples
Create Sequence
CREATE SEQUENCE [dbo].[CustomersSeq] AS INT START WITH 10001 INCREMENT BY 1 MINVALUE -1;
Use Sequence in Table
CREATE TABLE [dbo].[Customers] ( CustomerID INT DEFAULT (NEXT VALUE FOR [dbo].[CustomersSeq]) NOT NULL, CustomerName VARCHAR(100), );
Insert Into Table with Sequence
INSERT INTO [dbo].[Customers] ([CustomerName]) VALUES ('Jerry'), ('Gorge') SELECT * FROM [dbo].[Customers] Results CustomerIDCustomerName10001Jerry10002Gorge
Delete From & Insert New
DELETE FROM [dbo].[Customers] WHERE CustomerName = 'Gorge'; INSERT INTO [dbo].[Customers] ([CustomerName]) VALUES ('George') SELECT * FROM [dbo].[Customers] Results CustomerIDCustomerName10001Jerry10003George
Page 1 of 1
1
Cookie
This website stores cookies on your computer.
We use cookies to enhance your experience on our website and deliver personalized content.
For more details on our cookie usage, please review our
Cookie Policy
and
Privacy Policy
Accept all Cookies
Leave this website