Re: CTime library & MS SQL Server date field.

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.