Of Interest
Be responsible for your future Enter the USA legally!
Visa, Green Card, Citizenship, Passport Consultation Services
|
Sybase
»
DDL
»
Coding
»
Binding Rules to Colunms
Default values for colunms can be specified at the time a table is created, or
afterwards via the modify command.
/* Employee will have a default salary of 10000, and a hire date of today */
create table employee (
emp_id integer not null,
salary money default 0,
hire_dt datetime default getdate()
)
go
/* alter the table, so salary starts at 49000 */
ALTER TABLE employee REPLACE salary DEFAULT 49000
go
/* create a new default; bind the column to your custom default */
create default def_highsal as 55000
go
sp_bindefault def_highsal,'employee.salary'
go
-- creating your own custom defaults has a significant advantage:
-- you can actually choose the name of the default.
|
|
|
Get the latest Rocket99 news and tech tips via
|