|
|
Question : Sybase - Proper Sytnax to Alter an existing table and ADD a constraint
|
|
I am in the midst of defing sybase tables and I am using the templates from a m-sql table, I bellieve.
I need to translate the following syntax to properly run on sybsae properly:
ALTER TABLE [scehedule_exception] WITH NOCHECK ADD CONSTRAINT [DF_schedule_exception_date] DEFAULT (getdate()) FOR [date], CONSTRAINT [DF_schedule_exception_event_id] DEFAULT (0) FOR [event_id]
*** I need Sytnax
|
Answer : Sybase - Proper Sytnax to Alter an existing table and ADD a constraint
|
|
Which Sybase database? They have three main ones and the syntax is different in all of them...
Assuming you mean Sybase ASE, neither of these are actually constraints. The correct syntax is:
ALTER TABLE schedule_exception REPLACE date DEFAULT getdate()
ALTER TABLE schedule_exception REPLACE event_id DEFAULT 0
This will not affect any existing rows in the table. Also if event_id has a unique index or primary key on it this will fail the second time the default is used. Finally "date" is a keyword in most recent versions of ASE.
|
|
|
|