Skip to Content.
Sympa Menu

freetds - Re: [freetds] CTime library & MS SQL Server date field.

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] CTime library & MS SQL Server date field.
  • Date: Mon, 19 May 2008 13:17:28 -0400

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?)

Second choices:

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)
2> go

-------------------
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.

HTH.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page