[freetds] CTime library & MS SQL Server date field.
James K. Lowden
jklowden at freetds.org
Mon May 19 13:17:28 EDT 2008
Enrico Coi wrote:
> how can I
> catch the current time on my machine (using CTime library) and send it
> as a record field in a MS SQL 2005 DB?
The best answer is: don't. Instead, define the column with a default of
getdate() and let the server set the time when you insert the row. If you
want the same on updates, write a trigger, or include that in your stored
procedure. (You are using stored procedures, right?)
1. time(3), localtime(3), and strftime(3).
2. SELECT getdate() from the server.
The server is pretty flexible about input formats. I recommend YYYYMMDD:
1> select cast('20070102 13:14:15' as smalldatetime)
Jan 02 2007 01:14PM
> how can i run the cross compiled FreeTDS into a chroot jail?
I can't think of anything special about FreeTDS concerning chroot except
getting freetds.conf (and the libraries, of course) in the right places.
That's just a question of setting up your environment and, yes, OT here.
More information about the FreeTDS