https://learn.microsoft.com/en-us/sql/t-sql/functions/identity-transact-sql
Questions tagged [sql-server-identity]
4 questions
21
votes
3 answers
SQL create statement incorrect syntax near auto increment
I created the following table, but I got the error below;
Incorrect syntax near 'AUTO_INCREMENT'.
SQL:
CREATE TABLE [dbo].[MY_TABLE] (
[ID] INT NOT NULL AUTO_INCREMENT,
[NAME] NVARCHAR (100) NULL,
[SCHOOL] NVARCHAR…

Sharon Watinsan
- 9,620
- 31
- 96
- 140
2
votes
0 answers
Creating Credential to run SQL Server Agent Job on Server NOT on a domain
I have set up a SQL Server on an EC2 instance that is NOT on a domain.
I need the SQL Server Agent to run SSIS scripts, do back ups, send DB Mail, . I have set up a sql server user with read / write db permissions, and tried to follow the…

Mike de H
- 599
- 2
- 6
- 13
1
vote
1 answer
Reset IDENTITY column whitout deleting all rows
I have the following table
CREATE TABLE [dbo].[MyTable](
[Name] NVARCHAR(200) NOT NULL,
[Surname] NVARCHAR(200) NOT NULL,
[Permanent] [bit] NULL,
[Idx] [bigint] IDENTITY(1,1) NOT NULL
CONSTRAINT [MyTable] PRIMARY KEY CLUSTERED
(
…

Nicolaesse
- 2,554
- 12
- 46
- 71
1
vote
1 answer
ServiceStack Identity on field other than PK - Insert fails
When I try to use the "Insert" function in ServiceStack (against SQL Server 2014) using an object from the below class, it tries to insert a 0 (default of the ContactId property) for the ContactId instead of auto generating one in the database.…

Chris Klepeis
- 9,783
- 16
- 83
- 149