A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
You can do this, but you must create the UNIQUE constraint in a separate statement. So the end of your CREATE TABLE statement would be
ALTER TABLE [dbo].[user_main] ADD [compname] nvarchar NULL
ALTER TABLE [dbo].[user_main] ADD [compaddr] nvarchar NULL
PRIMARY KEY CLUSTERED
(
[user_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
and then you would follow that with
ALTER TABLE [dbo].[user_main] ADD CONSTRAINT [cons_user_main2] UNIQUE NONCLUSTERED
(
[user_name] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
Tom