I am trying to get the user ID to default on additions and changes to a table defined using DDL. The only special register value I can get to work is USER. When I add records to the table outside of SQL the user ID field is blank. I am also using the CURRENT_TIMESTAMP register for a timestamp value and it works fine.
Using SYSTEM_USER or SESSION_USER results in an error creating the table. It doesn't like the , at the end of the line.
Anyone have any ideas how to get the user ID to default on adds outside of SQL?
Here's the SQL statement:
Create table #785/ERRSVRTY (
Error_Severity for ERRSEV Numeric(1,0) not null,
Description for DESCR Char(50) not null,
Add_User for ADDUSER Char(18) not null with default USER,
Add_Timestamp for ADDTMSTP Timestamp not null
with default CURRENT_TIMESTAMP,
Update_User for UPDUSER Char(18) not null with default USER,
Update_Timestamp for UPDTMSTP Timestamp
with default CURRENT_TIMESTAMP,
-- Add primary key
Constraint ERRSVRTY_Key Primary Key (Error_Severity));
Rick Chevalier
IT Software Solutions - Loan Servicing
AmeriCredit<
http://www.americredit.com/images/acf_email_sig.gif>
817-525-7178 (w)
rick.chevalier@xxxxxxxxxxxxxxx<mailto:rick.chevalier@xxxxxxxxxxxxxxx>
________________________________
Privileged and Confidential. This e-mail, and any attachments there to, is intended only for use by the addressee(s) named herein and may contain privileged or confidential information. If you have received this e-mail in error, please notify me immediately by a return e-mail and delete this e-mail. You are hereby notified that any dissemination, distribution or copying of this e-mail and/or any attachments thereto, is strictly prohibited.
As an Amazon Associate we earn from qualifying purchases.