3

I have a scenario. I want my inmemory table column to accept multiple NULL values but when entered something besides NULL, It should be unique. This i kept doing in Disk tables using CREATE UNIQUE NONCLUSTERED INDEX.

ex:

CREATE UNIQUE NONCLUSTERED INDEX  [IX_customer_PRN]
ON [dbo].[customer](PRN)
WHERE PRN IS NOT NULL
GO

Need suitable alternative in IN MEMORY tables.

Rigerta
  • 3,959
  • 15
  • 26
Younus Mohammed
  • 165
  • 1
  • 1
  • 7

1 Answers1

2

As stated in the documentation for in-memory tables, you should be able to achieve what you need by just creating a unique non-clustered index on the table, as below:

ALTER TABLE [dbo].[customer]
    ADD CONSTRAINT IX_customer_PRN
    UNIQUE NONCLUSTERED (PRN);  
GO
Rigerta
  • 3,959
  • 15
  • 26