1
votes

Hi have my tbl_student containing

StudentID(Varchar), Lastname(Varchar), Firstname(Varchar),
Middlename(Varchar), Gender(Varchar), DateOfBirth(Date),
Address(Longtext), PhoneNumber(Varchar), Email(Varchar),
Modified(Timestamp)

I'm trying to create a Stored Procedure which is INSERT INTO the table. I can create the procedure WITHOUT the timestamp. Can somebody help me how to QUERY a Stored Procedure with timestamp in it. Thanks i tried this Code but it doesn't work

INSERT INTO tbl_student VALUES (studid, ln, fn, mn, gendr, bday, addrs, cntct, eemail, modi)`

Can anyone help me? thanks

1
Start by deciding whether it is MySQL or SQL Server (2 very different things). Then show the stored procedure and tell us what happens - it doesn't work is not very heloful - Ňɏssa Pøngjǣrdenlarp
SQL Server timestamp is not intended to be modified by the user, the server changes the value when a record is updated. Also, timestamp is not a date/time. So, even if your sp did work it wouldn't be valid. - rheitzman
sorry, im using MySQL sir.. the code above is the SP i created via routines with. all the attributes are input including the timestamp(current time) - Al Omar

1 Answers

2
votes

Assuming it's Mysql and the column type is Timestamp, we can use MySql's CURRENT_TIMESTAMP() in the insert query to set the field value, e.g.:

INSERT INTO TBL_STUDENTS (studid, modified_time..) values (1,CURRENT_TIMESTAMP())