[thelist] MS SQl help ASAP
Ken Schaefer
Ken at adOpenStatic.com
Wed Jan 5 05:43:02 CST 2005
This is a hack, but if 0-100 are valid responses, then
SELECT
*
FROM
Blah AS a
WHERE
a.PersonalIdentified < 0
OR
a.PersonalIdentifier > 100
might work.
But personally I you should have a different table schema. Store the freeform
text in another field, and have a set value (eg NULL) in your existing field
that indicates whether the free-text field should be used or not. Then you
can enforce a numeric data type on that field, and it'll make your queries a
lot easier.
Cheers
Ken
: -----Original Message-----
: From: thelist-bounces at lists.evolt.org [mailto:thelist-
: bounces at lists.evolt.org] On Behalf Of Ian Barber
: Sent: Wednesday, 5 January 2005 8:27 PM
: To: thelist at lists.evolt.org
: Subject: RE: [thelist] MS SQl help ASAP
:
: thelist-bounces at lists.evolt.org wrote:
: >> -----Original Message-----
: >> From: Brian Cummiskey
: >> Sent: Tuesday, January 04, 2005 4:32 PM
: >>
: >> a quick select distinct yeilds:
: >>
: >>
: >> NULL
: >>
: >> "april"
: >> (RPQ)PHONEDISC.
: > <snip>
:
:
: Am I missing a reason why you couldn't do something like:
:
: select * from blah
: where blah = 1
: and PersonalIdentifier like '%[^0-9]%'
:
: that will just get you anything that contains characters other than 0 to
: 9.
: It'll fail on the null though, so you could coalesce to get around that,
: or
: use ansi nulls.
:
: select * from blah
: where blah = 1
: and Coalesce(PersonalIdentifier, 'NaughtyNull') like '%[^0-9]%'
:
: Ian.
:
: --
:
: * * Please support the community that supports you. * *
: http://evolt.org/help_support_evolt/
:
: For unsubscribe and other options, including the Tip Harvester
: and archives of thelist go to: http://lists.evolt.org
: Workers of the Web, evolt !
More information about the thelist
mailing list