I was curious if there was a way to query in tsql whether or not a table's key in clustered or not using table_name or object_id or whatever is best?
Here is a table that has a clustered primary key set. I know that there are tables in my database that are Not clustered on the pk and I will need to know this when I perform some future processing.
Thanks, All.
Patrick
Here is a table that has a clustered primary key set. I know that there are tables in my database that are Not clustered on the pk and I will need to know this when I perform some future processing.
Code:
CREATE TABLE [dbo].[UserRole](
[RoleId] [uniqueidentifier] NOT NULL,
[UserId] [uniqueidentifier] NOT NULL,
[CreateDate] [datetime] NOT NULL,
CONSTRAINT [PK_dbo.UserRole] PRIMARY KEY CLUSTERED
(
[RoleId] ASC,
[UserId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
Patrick