WHERE clause error  
Author Message
kompeelit





PostPosted: Sun Aug 24 18:02:06 CDT 2003 Top

SQL Server Developer >> WHERE clause error

Below, I'm trying to restrict my results in the USERNOTES field if there is
a numeric value in the first 2 characters. The ISNUMERIC part works within
the main query because I'm using the same syntax with a CASE statement. I
only get an error with my query if I add the ISNUMERIC part.

Shouldn't the ISNUMERIC part below return the record if a numerical value is
in the first 2 digits of USERNOTES field?

Error simply says "Error near ORDER BY"


WHERE (tblDowntime.DTID = 1) AND
ISNUMERIC(SUBSTRING(tblDowntime.UserNotes, 1, 2))
ORDER BY tblDowntime.StartDateTime

Any ideas?

SQL Server151  
 
 
Dan





PostPosted: Sun Aug 24 18:02:06 CDT 2003 Top

SQL Server Developer >> WHERE clause error Your need to check for the desired ISNUMERIC value. Try:

WHERE (tblDowntime.DTID = 1) AND
ISNUMERIC(SUBSTRING(tblDowntime.UserNotes, 1, 2)) = 1
ORDER BY tblDowntime.StartDateTime

--
Hope this helps.

Dan Guzman
SQL Server MVP

-----------------------
SQL FAQ links (courtesy Neil Pike):

http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
-----------------------



> Below, I'm trying to restrict my results in the USERNOTES field if
there is
> a numeric value in the first 2 characters. The ISNUMERIC part works
within
> the main query because I'm using the same syntax with a CASE
statement. I
> only get an error with my query if I add the ISNUMERIC part.
>
> Shouldn't the ISNUMERIC part below return the record if a numerical
value is
> in the first 2 digits of USERNOTES field?
>
> Error simply says "Error near ORDER BY"
>
>
> WHERE (tblDowntime.DTID = 1) AND
> ISNUMERIC(SUBSTRING(tblDowntime.UserNotes, 1, 2))
> ORDER BY tblDowntime.StartDateTime
>
> Any ideas?
>
>


 
 
oj





PostPosted: Mon Aug 25 01:59:04 CDT 2003 Top

SQL Server Developer >> WHERE clause error ISNUMERIC(SUBSTRING(tblDowntime.UserNotes, 1, 2))=1

--
-oj
Rac v2.2 & QALite!
http://www.rac4sql.net




> Below, I'm trying to restrict my results in the USERNOTES field if there
is
> a numeric value in the first 2 characters. The ISNUMERIC part works within
> the main query because I'm using the same syntax with a CASE statement. I
> only get an error with my query if I add the ISNUMERIC part.
>
> Shouldn't the ISNUMERIC part below return the record if a numerical value
is
> in the first 2 digits of USERNOTES field?
>
> Error simply says "Error near ORDER BY"
>
>
> WHERE (tblDowntime.DTID = 1) AND
> ISNUMERIC(SUBSTRING(tblDowntime.UserNotes, 1, 2))
> ORDER BY tblDowntime.StartDateTime
>
> Any ideas?
>
>