无法创建SQL Server 2008中的序列 [英] Can't create sequence in SQL Server 2008
问题描述
我曾尝试使用下面的查询创建SQL Server 2008中的序列,
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,
消息102,级别15,状态行1结果
附近有语法错误序列。
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'SEQUENCE'.
如何创建SQL Server 2008的序列?
How to create a sequence in SQL Server 2008?
推荐答案
您就不能做到这一点。
SQL Server 2008中没有一个 SEQUENCE的概念
- 这是的 SQL Server 2012中的(MSDN文档在这里)。
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,
.....
这篇关于无法创建SQL Server 2008中的序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!