Skip to content
Advertisement

The operation failed because an index or statistics with name ‘XPKUSERS’

Need help in understanding the error “The operation failed because an index or statistics with name ‘XPKUSERS'” and help in converting the query to TSQL

Msg 1913, Level 16, State 1, Line 1
The operation failed because an index or statistics with name ‘XPKUSERS’ already exists on table ‘TDM_USERS_AUTH’.
Msg 1750, Level 16, State 0, Line 1
Could not create constraint or index. See previous errors.

Advertisement

Answer

The USING INDEX clause is a syntax specific to Oracle. In SQL Server, a new index is always created when you create a primary key. You can only choose if the new index is clustered (which is by default) or non-clustered.

You can simply create the PRIMARY KEY (without creating the index before), like this:

You can also specify the primary key when creating the table:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement