When it comes to handling datetime on SQL server it can get quite error prone when you are dealing with different regions and end up getting an out or range date exception if you are trying to add a date that is in EU date format to a server that is expecting a US date format.
Rather than having to worry about generating the string for the timestamp you can make SQL Server generate the timestamp for the datetime field automatically when you insert the row. This can be done by setting the default value for the field to a method called “getdate()”.
If you are using SQL Server Management Studio you can set the default value of datetime to the current time using the following. Make sure you set “Allow Nulls” to no and then add the method to the default value field.