[Sussex] Postgresql date fields
G.J. Teale
gteale at cmedresearch.com
Thu Oct 27 10:47:32 UTC 2005
"Brendan Whelan" <b_whelan at mistral.co.uk> writes:
> Ronan wrote:
>>Anyone know the SQL syntax for checking to see if a date field in
>>postgres is empty? Having a bit of a dunce day and can't work it out,
>>despite RTFMing!!!
>
>>Any postgresers out there?
>
> I use MySQL and the syntax would be
> select * from my_table where my_field = ""
>
> Hope this helps, Brendan
*Arrrrrgh* Spider sense (or rather computer science sense) is
tingling. This is _soooooo_ wrong. The unset state on any field
should be checked against NULL. You should only check against empty
string if you;re checking for a CHAR type that has explicitly set to
"". I hope it isn't MySQL forcing you down that route.
So:
SELECT * FROM your_table WHERE your_field IS NULL
--
G. J. Teale Software Engineering Team Leader
Cmed Group Ltd.
Holmwood, Broadlands Business Campus,
Langhurstwood Road, Horsham, RH12 4QP, United Kingdom
T +44(0)1403 755 071
F +44(0)1403 755 051
M +44(0)7776 195 211
E gteale at cmedresearch.com
W www.cmedresearch.com
__________________________________________________________
Driven by technology. Guided by experience.
__________________________________________________________
The IBM purchase of ROLM gives new meaning to the term "twisted pair".
-- Howard Anderson, "Yankee Group"
More information about the Sussex
mailing list