Thank you Dennis. 

That does make sense. In my particular situation, I'd have to typecast the
variable fed to the SQL, since it is an INT type that holds the day that is
to be searched on.

What I ended up doing, for purposes of time and because there are other
routines that will need to do this as well, is that when I created the
table, I added an additional column of type INT with the day value already
there. So now I'll just do a search on that column and be done with it. But
thanks though, because I wish to learn what is available to me using SQLite
with my VB6.

To John Machin: To save from answering multiple messages (and save space for
all), I'll address John's reply here.

----------------------------------------------------------------------
"Consider getting answers faster by (a) trying things out yourself, e.g. 
type this at the sqlite3 command-line program:

select CAST(strftime('%d', '2009-06-30'), INTEGER);

and (b) looking at the docs; in this case
http://www.sqlite.org/lang_expr.html";
----------------------------------------------------------------------

I'll consider myself admonished. But let me say that I go through a lot of
searching and testing before I ask questions. Also, I'm a novice programmer
and really new to SQLite. So some things may be more obvious to others than
to me. I'm not yet familiar with a "sqlite3 command-line program". I'm
programming in VB6. My question on CAST wasn't so much whether I can do it
(as testing would bear out), but was more towards whether I should do it.
Experts here could steer me away towards a better way that I'm not aware of.

Anyway, thank you John.

Regards,
Rick
 

 

-----Original Message-----
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Dennis Cote
Sent: Tuesday, July 07, 2009 8:22 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Query by Day

Rick Ratchford wrote:
> So what I need to do then is to make the return of strftime of type INT.
>
> Can CAST(strftime('%d', Date), INTEGER) be used in this context, or is 
> there another way?
>
>   
Rick,

You could use a cast (with correct syntax) as you have suggested

    CAST(strftime('%d', Date) AS INTEGER)

Or you could simply provide the day you are checking for as a string. To do
this, surround the number with single quotes to turn it into a string
literal.

SQLString = "SELECT strftime('%d', Date) as Day, IsSwingTop1 as Tops,
IsSwingBtm1 as Btms " & _
                "FROM TmpTable WHERE Day = '11'"


HTH
Dennis Cote
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to