0

I have the following SQL statement:

insert into [Order](UserId,MembershipType,PaymentAmt,PaymentStatus,StartDate,EndDate,Status)output INSERTED.OrderId values('18','Yearly','9.99','','2017-02-14 15:13:22','2018-02-14 15:13:22','1');Select Scope_Identity()

Which will insert the data in to my dbo.Order table in my Microsoft SQL Server 2014 database locally on my PC.

But when I run this query on a live 3rd party web server (With an identical database table) I get the following error:

exception=Cannot insert the value NULL into column 'OrderId', table 'db1128212_MYDATABASE.dbo.Order'; column does not allow nulls. INSERT fails.

Why is this?

Harry Boy
  • 4,159
  • 17
  • 71
  • 122

1 Answers1

0

Set the OrderId column on the remote table to identity/auto increment.

Auto increment primary key in SQL Server Management Studio 2012

Community
  • 1
  • 1
TrevorBrooks
  • 3,590
  • 3
  • 31
  • 53