Groups | Blog | Home
all groups > inetserver asp general > august 2005 >

inetserver asp general : setting variable in query


Joey Martin
8/21/2005 7:59:14 PM
I have a sql query that runs on my asp page.

select
contactname,contactnumber,contactnumber1,contactemail,address,city,state
,zip,type,sqft,0,bedrooms,baths,lotsize,acreage,garage,comments,price,0,
0,county from table1 where active='Y'

I need HASPHOTO to equal 1 if hasphoto <> 0 and HASPHOTO=0 when
hasphoto=0. Make sense? HASPHOTO usually equals a number, but in this
case, I want it to equal a 1 or 0 because I am exporting this to a CSV
file. I know how to do everything else, just not this part.

Thanks in advance.

Joey Martin
8/22/2005 4:26:14 AM
This is a SQL 2K server. HASPHOTOS is an int field. It is one of the
columns in my table.


Bob Barrows [MVP]
8/22/2005 5:52:32 AM
[quoted text, click to view]

Not really. Is hasphoto a column in your table? What is its datatype?

[quoted text, click to view]

What database? Type and version, please.

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Bob Barrows [MVP]
8/22/2005 7:42:34 AM
[quoted text, click to view]

SELECT ...,
CASE HASPHOTOS WHEN 0 THEN 0 ELSE 1 END [HASPHOTOS]
....

HTH,
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

AddThis Social Bookmark Button