I am trying to write a database creation script and on one table I need to assign a default date to a column of data type "DATETIME YEAR TO MINUTE". I wish to assign the current date.
Any help would be great!
Thanks for the reply,
I'll explain futher what I am trying to do:
I have a SQL script which creates the database and tables (I'm importing data afterwards using the MS-DTC from another DBMS)
Below you'll find the troublesome table, I have made the problem line in RED
create table report_result_head (
report_result_id serial(10001) not null,
report_name varchar(50),
served_flag char(1) default "n"
check (served_flag is null or ( served_flag in ("y","n")),
create_date datetime year to minute default CURRENT,
primary key (report_result_id)
constraint pk_report_result_h
);
I believe you're going to have to write a trigger to make this happen. I haven't written a trigger in several years, so I'd have to pull out the manual.
It you read the thread HELP WITH TRIGGERS right after this thread, it should give you some idea how to proceed.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.