I have tried to create a sequence in SQL Server 2008 using the following query,
CREATE SEQUENCE serial START 100
I got the following syntax error,
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'SEQUENCE'.
How to create a sequence in SQL Server 2008?
The syntax to a view the properties of a sequence in SQL Server (Transact-SQL) is: SELECT * FROM sys. sequences WHERE name = 'sequence_name'; sequence_name.
CREATE SEQUENCE rid_seq; ALTER TABLE test ADD COLUMN rid INTEGER; ALTER TABLE test ALTER COLUMN rid SET DEFAULT nextval('rid_seq');
The cache is maintained in memory by tracking the current value (the last value issued) and the number of values left in the cache. Therefore, the amount of memory used by the cache is always two instances of the data type of the sequence object.
You just cannot do this.
SQL Server 2008 does not have the concept of a SEQUENCE
- this is a new feature in SQL Server 2012 (MSDN documentation here).
Typically, you want to create an "auto-increasing" column for your table - in that case, use the IDENTITY
column attribute instead:
CREATE TABLE dbo.YourTable
( TableID INT IDENTITY,
.....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With