[Gambas-user] sql query year problem

Werener Staudacher admin at ...1080...
Mon Mar 6 11:55:45 CET 2006


Hi Rohnny

Every (or most) SQL Server uses another Syntax for Date.  
If you want SQL Cross-Syntax forget Server-specific statments and go back to
basics supportet by all (or most), like substring, left, right, charindex.
But! not shure if there is any statement supportet by all SQL servers, and
then an other difficulty is how dates are stored in the DB. 
The other way is to create the SQL string programaticaly in Gambas, select
case dbType case "mysql" whereDate="year(xxxx)" case "sqllight"
whereDate="dontknow()" end select query="Select * From Table where " &
whereDate
Or the easy-way, you can store the year from the date in a separate field
and ask for this "where fieldYear='2006'"
You see there are some workarounds.

Regards, Staudi




> -----Original Message-----
> From: gambas-user-admin at lists.sourceforge.net 
> [mailto:gambas-user-admin at lists.sourceforge.net] On Behalf Of 
> R. Stormo
> Sent: Sunday, March 05, 2006 12:14 PM
> To: gambas-user at lists.sourceforge.net
> Subject: [Gambas-user] sql query year problem
> 
> 
> Looking for a solution to select records from a choosen year. 
> Would be perfect if the same sql works for postgres and 
> sqlite3 In MsSql it would be done like this.
> SELECT id, dato FROM mytable WHERE year(dato)=2006
> --
> Regards
> 	Rohnny Stormo
> 
> 
> -----------------------------------------
> Gambas brings Basic to Linux.
> My Gambas Community http://forum.stormweb.no
> 
> --
> View this message in context: 
> http://www.nabble.com/sql-query-year-problem-t1227953.html#a3247550
> Sent from the gambas-user forum at Nabble.com.
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking 
> scripting language
> that extends applications into web and mobile media. Attend 
> the live webcast
> and join the prime developer group breaking into this new 
> coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&
> dat=121642
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user





More information about the User mailing list