borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Prevent System Date BackWard)Next Topic (Button to save data to SQL Server) New Topic New Poll Post Reply
AndreaVB Forum : VB General : SQL SERVER 2000 with Conditional select Statement Solved Topic
Poster Message
VYX
Level: Professor


Registered: 16-12-2005
Posts: 70

icon SQL SERVER 2000 with Conditional select Statement

How can i make a sql select statement that will do like this that if the age is less than 18 it will create a new field like status which value is 'notallowed' and if age is greater or equal to 18 the field status created will put a value 'allowed'

tablename:tblinfo
field:name,age


name         age          status
-----------------------------------
a                15             allowed
b                18             notallowed
c                 18            allowed


select name,age (if age>=18):status='ALLOWED' ELSE STATUS='NOTALLOWED' FROM TBLinfo


Anybody have any idea on how to do like this to integrate  with vb6 code..

i believe that sql server 2000 could do the conditional with select statement ?


thank you very much in advance guys..

I really appreciate all your post here

28-07-2007 at 02:38 AM
View Profile Send Email to User Show All Posts | Quote Reply
stickleprojects
Level: Moderator


Registered: 09-09-2002
Posts: 891
icon Re: SQL SERVER 2000 with Conditional select Statement

Hi,

select name,age, (CASE WHEN age>=18 THEN 'ALLOWED' ELSE 'NOTALLOWED' END) as Status FROM TBLinfo



Hope this helps,
Kieron


____________________________
Build it better, faster, quicker, easier.. then fix it (non-offical MS mission statement)

07-08-2007 at 02:42 PM
View Profile Send Email to User Show All Posts | Quote Reply
VYX
Level: Professor


Registered: 16-12-2005
Posts: 70
icon Re: SQL SERVER 2000 with Conditional select Statement

Thank you very much kieron..

wow.. so great...Im so glad for your immediate help. my problem was solved. it did what i suppose to be...thanks a lot !!!

Now im trying to convert my sql server 2000 into sql server 2005. I have an installer standard edition and installed to my pc but it seems not just like a sql server 2000 that your going to enterprise manager and create a database and tables there..

Do you have any links that guide me through? or a downloadable ebooks that could help me..

thanks again...

vyx



[Edited by VYX on 11-08-2007 at 04:06 PM GMT]

11-08-2007 at 08:03 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : SQL SERVER 2000 with Conditional select Statement Solved Topic
Previous Topic (Prevent System Date BackWard)Next Topic (Button to save data to SQL Server) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder