tclodbc, SQL Server, date nighmare



Hi,

I am trying to get a query to work correctly with tclodbc and SQL
Server on WIndows but it systematically fails.

If I try this:

set date [clock format [clock scan [lindex $argv 0]] -format "%Y-%m-
%d"]
db "select uuid from extract where savetime < $date"

I get no results. If I try:

db "select uuid from extract where savetime < '$date'"

I get:

37000 8114 {[Microsoft][ODBC SQL Server Driver][SQL Server]Error
converting data type varchar to numeric.}

The reason is that the first query yields this in SqlServer:

select uuid from extract where savetime < 2005-12-01

and the second one gives

select uuid from extract where savetime < ''2005-12-01''

The only way to get the proper results is to generate this:

select uuid from extract where savetime < '2005-12-01'

Notice the number of siingle quotes. I tried variations of [list] "",
{}, etc. I can't get the proper syntax. Can anyone help?

L

.



Relevant Pages

  • Re: tclodbc, SQL Server, date nighmare
    ... I am trying to get a query to work correctly with tclodbc and SQL ... select uuid from extract where savetime < ''2005-12-01'' ...
    (comp.lang.tcl)
  • Re: tclodbc, SQL Server, date nighmare
    ... db "select uuid from extract where savetime < $date" ... put the single quotes inside the variable $date. ... this is just a wild guess on my part. ...
    (comp.lang.tcl)
  • Re: datetime from uuid1 timestamp
    ... Why would you want to extract the exact timestamp from the uuid? ... date solely from the filename. ...
    (comp.lang.python)
  • Re: DataTable.Select question
    ... The easisest way would be to add a column to your DataTable, ... manually accordingly (extract minutes from SaveTime field) to ... > after adding new rows saves DataTable as XML-file. ... > DateTime Field named as "SaveTime", ...
    (microsoft.public.dotnet.framework.adonet)