howto post date,guid parameter to sql str when execute sql via IWorkspace.ExecuteSQL

686
3
Jump to solution
06-28-2012 12:29 AM
zszs
by
New Contributor III
i execute sql use IWorkspace.ExecuteSQL method,the parameter must be  string ,what the date,guid format is in the sql string
i use sql like this, "insert into TB1(ClmD) values('2012-1-1')",ClmD is Date Type
but got exception,and the database i used is gdb
and it works fine on mdb
how to write sql string on gdb when has date,guid value
thanks a lot!!!
0 Kudos
1 Solution

Accepted Solutions
zszs
by
New Contributor III
IQuery.Date1 needs date parameter by string type
what is the format at this place

View solution in original post

0 Kudos
3 Replies
zszs
by
New Contributor III
IQuery.Date1 needs date parameter by string type
what is the format at this place
0 Kudos
zszs
by
New Contributor III
right format is,"Datefield" = date 'yyyy-mm-dd'
the sql is,"insert into TB1(ClmD) values(date '2012-1-1')"
http://help.arcgis.com/en/arcgisdesktop/10.0/help/#/SQL_reference_for_query_expressions_used_in_ArcG...
this page has the detail about query expressions
0 Kudos
JamesCrandall
MVP Frequent Contributor
right format is,"Datefield" = date 'yyyy-mm-dd'
the sql is,"insert into TB1(ClmD) values(date '2012-1-1')"
http://help.arcgis.com/en/arcgisdesktop/10.0/help/#/SQL_reference_for_query_expressions_used_in_ArcG...
this page has the detail about query expressions


I believe it all depends upon your underlying database (is it SQL Server, Oracle, etc??) as to how you need to write it to the database.  You say "gdb", but what is the database?  And does your date field in the db contain the time portion of the date?

All of these factors will affect how you need to store values.
0 Kudos