Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are so many possibilities here, and I'm not sure which situation you're hitting, and what you want to do in each case:</p> <pre><code>USE [tempdb]; -- table with a clustered PK CREATE TABLE dbo.TableA(rec_index INT IDENTITY(1,1) PRIMARY KEY CLUSTERED); -- table with non-clustered PK CREATE TABLE dbo.TableB(rec_index INT IDENTITY(1,1) PRIMARY KEY NONCLUSTERED); -- table with no PK, no indexes CREATE TABLE dbo.TableC(rec_index INT IDENTITY(1,1)); -- table with no PK, non-clustered non-unique index CREATE TABLE dbo.TableD(rec_index INT IDENTITY(1,1)); CREATE INDEX d ON dbo.TableD(rec_index); -- table with no PK, clustered non-unique index CREATE TABLE dbo.TableE(rec_index INT IDENTITY(1,1)); CREATE CLUSTERED INDEX e ON dbo.TableE(rec_index); -- table with no PK, non-clustered unique index CREATE TABLE dbo.TableF(rec_index INT IDENTITY(1,1)); CREATE UNIQUE INDEX f ON dbo.TableF(rec_index); -- table with no PK, clustered unique index CREATE TABLE dbo.TableG(rec_index INT IDENTITY(1,1)); CREATE UNIQUE CLUSTERED INDEX g ON dbo.TableG(rec_index); -- table with unique clustered index, but PK on different column CREATE TABLE dbo.TableH(rec_index INT IDENTITY(1,1), b INT PRIMARY KEY NONCLUSTERED); CREATE UNIQUE CLUSTERED INDEX h ON dbo.TableH(rec_index); GO DROP TABLE dbo.TableA,dbo.TableB,dbo.TableC,dbo.TableD, dbo.TableE,dbo.TableF,dbo.TableG,dbo.TableH; GO </code></pre> <p>You can certainly perform checks for each of these scenarios from the system metadata, and react accordingly. But you need to help us narrow down what you mean by "without the index."</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload