View Full Version : Using AND in Select Script

09-25-2002, 03:37 PM
Hi All,

trying to select some field from a Sybase Database, see below for my piece of code, the select statement is not returning any record if AND is use. How can I resolve this, any help. See code below;

SELECT * from nitel_bill_payment where sequence_number = " &pcode& " AND bill_number = "&bill&"

where &pcode& and &bill& are textboxes name



09-25-2002, 05:41 PM
Uh, is there a javascript question here? One of the moderators will move this post for you to the server-side section

However, what you have seems to be a proper ANSI SQL type statment, although I tend to shy away from all those extra spaces

FROM nitel_bill_payments
WHERE sequence_number="&pcode&" AND bill_number="&bill&"

Double check your column names too.

09-25-2002, 05:54 PM
I'll move this to the SQL forum.

09-25-2002, 11:38 PM
No idea about the SQL used for Sybase, but if the values you compare against are numbers, thus containing numerical values, why do you have to put &pcode& and &bill& in quotes? Am I correct in assuming that this creates string values?

I know for sure that MySQL would let you go away unnoticed if you compare number values against string values... but that's not true for all SQL databases.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum