create table CATEGORY (
CATEGORY_ID tinyint not null auto_increment,
CATEGORY_NAME char(100) null,
ADDED_ON timestamp null,
ADDED_BY char(20) null,
LAST_EDITED_ON timestamp not null default current_timestamp on update current_timestamp,
LAST_EDITED_BY char(20) not null default current_user,
constraint PK_CATEGORY primary key (CATEGORY_ID)
);
[web] using current_user [mysql]
Is it possible to set the current user as a default value for a table column? Something kind of like this:
You can't set a function as a default value, the exception being current_timestamp, but you can simulate what you want with a stored procedure. Just remember current_user() returns the user specified in the db connection string, which in a web application probably isn't the same as the logic user.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement