Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 prob with rowguid using newid() fn

Author  Topic 

Chopsmum
Starting Member

38 Posts

Posted - 2006-04-23 : 21:53:56
hi guys

cant find the prob, please help

ALTER TABLE [dbo].[tblUserDetails]
ALTER COLUMN [UserDetailRowGUID] [uniqueidentifier] set default newid()
go

error:Incorrect syntax near the keyword 'default'.

cm

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-04-23 : 23:19:44
You can't use ALTER COLUMN to define the DEFAULT value. Use CONSTRAINT instead

ALTER TABLE [dbo].[tblUserDetails] ADD CONSTRAINT
DF_UserDetails_UserDetailRowGUID DEFAULT newid() FOR [UserDetailRowGUID]




KH


Go to Top of Page

Chopsmum
Starting Member

38 Posts

Posted - 2006-04-23 : 23:25:09
KH you are a legend, thankyou. Im embarrassed that Im not learning fast enough

thankyou
cm
Go to Top of Page
   

- Advertisement -