Code Library
Home Submit Free Hosting Link To Us Contacts

SQL Creat table nc nodupes

SQL Creat table nc nodupes SQL SQL Creat table nc nodupes Download (.zip)



USE pubs
GO
if exists (select * from sysobjects where name='nc_nodupes' and type='U')
        DROP TABLE nc_nodupes
GO


CREATE TABLE nc_nodupes (
    id int NOT NULL ,
    str1 char (5)  NOT NULL ,
    str2 varchar(10)   NULL 

GO
CREATE UNIQUE CLUSTERED INDEX idxcl_str2 on nc_nodupes (str2)
CREATE UNIQUE INDEX idxNC ON nc_nodupes (str1) 
GO
SET NOCOUNT ON
go
DECLARE @i int
SET @i = 1240
WHILE @i < 1300 BEGIN
   INSERT INTO nc_nodupes  select @i, cast(@i AS char), cast(cast(@i * rand() AS int) as char)
   SET @i = @i + 1
 END 
go
SELECT first, root, id, indid FROM sysindexes
WHERE id = object_id('nc_nodupes')
  AND indid  > 1








Tatet