I have a insert function that insert data to server. there is ACTION_DATE column that keep the insert date of data. ...
insert into mytable(.., .., ACTION_DATE) VALUES(.., .., NOW())
But in my application database connection is dynamic.Default connection is MySQL and my insert function works fine (because I code it based on MySQL)
But when database changed to sql server, In MySQL its NOW(), But in SQL server it looks like getdate()..
insert into mytable(.., .., ACTION_DATE) VALUES(.., .., GETDATE())
but not exactly.. because I need both of dates as same format. so getdate() includes miliseconds that I don't need.. And also I don't want to change the insert statement or anything in code. How can I achieve this ?
Aucun commentaire:
Enregistrer un commentaire