SQL Creat table nc heap nodupes

Creat table nc heap nodupes

USE pubs
GO
if exists (select * from sysobjects where name='nc_heap_nodupes' and type='U')
	DROP TABLE nc_heap_nodupes
GO
CREATE TABLE nc_heap_nodupes (
    id int NOT NULL ,
    str1 char (5)  NOT NULL ,
    str2 char (600)  NULL 
) 
GO
CREATE UNIQUE INDEX idxNC_heap ON nc_heap_nodupes (str1) 
GO
SET NOCOUNT ON
GO
DECLARE @i int
SET @i = 1240
WHILE @i < 1300 BEGIN
   INSERT INTO nc_heap_nodupes select @i, cast(@i AS char), cast(@i AS char)
   SET @i = @i + 1
 END 
GO
SELECT first, root, id, indid FROM sysindexes
WHERE id = object_id('nc_heap_nodupes')
  AND indid  > 1