| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

01-09-04, 11:21
|
|
Registered User
|
|
Join Date: Jan 2004
Location: Oslo
Posts: 45
|
|
|
Need help putting this Query in the right ASP-way
|
|
Hi and thanx for reading my post..
Well.. my problem is that i cannot seem to get the CASE syntax correct within my ASP page. I'm not sure where to break the lines and all that.
I have searched the net for quiiite a while before posting this
Will be VERY glad if someone can help me to put the puzzle in the right ASP-way
---------------START---------------
strSQL = "SELECT enavn,fnavn,fodselsnr,fangenr,convert(char(10),reg
_date,104) " &_
"'status'= CASE when legal = '1' then "beginner" when legal = '2' then "intermediate" when legal = '3' then "professional" when kan_skal = 'kan' then "darlig foto" else 'status ikke angitt' END " &_
"FROM BILDE WHERE accepted LIKE " & "'1'" & " AND marked LIKE " & "'0'" & " AND pkode LIKE " & strDistrikt & " AND kan_skal LIKE " & "'kan'" & " AND arstall LIKE " & strArstall
---------------END-----------------
What i want to do is getting the three values from the SQL DB which are in the "legal" field (1, 2 or 3), and based on what it is display "beginner", "intermediate", "professional" or "darlig foto".
Best regards
Mirador
|
|

01-09-04, 12:58
|
|
Registered User
|
|
Join Date: Feb 2002
Posts: 2,232
|
|
strSQL = "SELECT enavn,fnavn,fodselsnr,fangenr,convert(char(10),reg
_date,104)," &_
"'status'= CASE when legal = '1' then 'beginner' when legal = '2' then 'intermediate' when legal = '3' then 'professional' when kan_skal = 'kan' then 'darlig foto' else 'status ikke angitt' END " &_
"FROM BILDE WHERE accepted LIKE " & "'1'" & " AND marked LIKE " & "'0'" & " AND pkode LIKE " & strDistrikt & " AND kan_skal LIKE " & "'kan'" & " AND arstall LIKE " & strArstall
|
|

01-09-04, 13:37
|
|
Registered User
|
|
Join Date: Jan 2004
Location: Oslo
Posts: 45
|
|
|
Thanx !!
|
|
W00w !!  .. that was a quick and gooood reply !
owe u a beer  hehe.. tnx a bunch..
Mirador..
Quote:
Originally posted by rnealejr
strSQL = "SELECT enavn,fnavn,fodselsnr,fangenr,convert(char(10),reg
_date,104)," &_
"'status'= CASE when legal = '1' then 'beginner' when legal = '2' then 'intermediate' when legal = '3' then 'professional' when kan_skal = 'kan' then 'darlig foto' else 'status ikke angitt' END " &_
"FROM BILDE WHERE accepted LIKE " & "'1'" & " AND marked LIKE " & "'0'" & " AND pkode LIKE " & strDistrikt & " AND kan_skal LIKE " & "'kan'" & " AND arstall LIKE " & strArstall
|
|
|

01-09-04, 16:10
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
|
|
rnealejr, your query still has singlequotes around status
i know, it's tough spotting every little thing, eh
see http://www.dbforums.com/t977350.html
Mirador, please do a favour to those who might wish to help you, please do not post the same question in more than one forum
and where's my beer?
|
|

01-09-04, 17:19
|
|
Registered User
|
|
Join Date: Feb 2002
Posts: 2,232
|
|
Rudy,
The 'status' is just another way to alias a column - just like "select price as 'Total Cost' from ...". However, it is available for backward compatibility, which may create problems with yukon -so beware. I have seen some interesting changes in yukon that might create major headaches for all of us. You can download from ms their best practices analysis tool that will help for migrating.
|
|

01-09-04, 17:31
|
|
Registered User
|
|
Join Date: Feb 2002
Posts: 2,232
|
|
mirador - What country are you programming for - It looks like German or another germanic language ... Ooohhhhh, how I remember (or better yet don't) the beer from Germany/Austria ... sacralicious ...
|
|

01-09-04, 21:18
|
|
Registered User
|
|
Join Date: Jan 2004
Location: Oslo
Posts: 45
|
|
Re : Need help putting this .....
German !?!? nononono.... Nor-we-gi-an here... a TRUE Viking  hehe..
Sorry for the doublepost... was at work and had about VERY little time to get it fixxed.. will _not_ happen again  ¨
Tnx for all the help.. Problem is solved tnx to u guys !
(no mad-boss-on-my-shoulders-weekend)
Happy weekend..
Mirador..
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|