473,385 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

CASE in a Select Problem

2
Hi,
I am getting a syntax error when I run the following, can anyone take a look and provide feedback?

TIA~

Tena

SELECT View_ACTIVE_IQ_USERS.fo_student_id, View_ACTIVE_IQ_USERS.user_pk1 AS ETUserID, 'Y' AS Active,
View_ACTIVE_IQ_USERS.first_name,View_ACTIVE_IQ_USE RS.address2,View_ACTIVE_IQ_USERS.address1,
Address = CASE View_ACTIVE_IQ_USERS.address2
WHEN View_ACTIVE_IQ_USERS.address2 is not null THEN (View_ACTIVE_IQ_USERS.address1 + ' ' + View_ACTIVE_IQ_USERS.address2)
WHEN View_ACTIVE_IQ_USERS.address2 null THEN View_ACTIVE_IQ_USERS.address1

END,
FROM View_IQ_Guardian INNER JOIN
View_ACTIVE_IQ_USERS ON View_IQ_Guardian.ETUserID = View_ACTIVE_IQ_USERS.user_pk1
Feb 23 '07 #1
3 1120
scripto
143 100+
for starts, remove the comma after END and let's see what happens...
Feb 23 '07 #2
tena
2
OK-tried that and still get:


Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'is'.


TIA~

Tena
Feb 23 '07 #3
Try this code

Expand|Select|Wrap|Line Numbers
  1. SELECT View_ACTIVE_IQ_USERS.fo_student_id, View_ACTIVE_IQ_USERS.user_pk1 AS ETUserID, 'Y' AS Active, 
  2. View_ACTIVE_IQ_USERS.first_name,View_ACTIVE_IQ_USE RS.address2,View_ACTIVE_IQ_USERS.address1,
  3. Address = CASE WHEN View_ACTIVE_IQ_USERS.address2 is not null THEN (View_ACTIVE_IQ_USERS.address1 + ' ' + View_ACTIVE_IQ_USERS.address2)
  4. WHEN View_ACTIVE_IQ_USERS.address2 null THEN View_ACTIVE_IQ_USERS.address1
  5. END
  6. FROM View_IQ_Guardian INNER JOIN
  7. View_ACTIVE_IQ_USERS ON View_IQ_Guardian.ETUserID = View_ACTIVE_IQ_USERS.user_pk1
Feb 25 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: Newbie | last post by:
Dear friends, I am having a hard time understanding how to use a SELECT CASE in ASP. I have used it in VB but never in ASP scripting. Scenerio: I have 2 textboxes on a form that I have to...
0
by: Tumurbaatar S. | last post by:
Hi, I'm running MySQL 3.23.55 on WinXP and have some problem using non latin charset. I've added these 2 lines under group of my.ini: character-sets-dir = c:/mysql/share/charsets/...
3
by: Matik | last post by:
Hello all, I belive, my problem is probably very easy to solve, but still, I cannot find solution: declare @i int declare @z int create table bubusilala (
2
by: JMCN | last post by:
hello i have your basic select case question. i created a combo box and save it as a query. so whenever the user selects the value and clicks the export button, the select case should then export...
10
by: MLH | last post by:
Suppose the following... Dim A as Date A=#7/24/2005# I wish to compare value of A against 2 other values: 1) 8/1/2005 2) 9/1/2005 Which is better and why... First:
3
by: mark.irwin | last post by:
Hello all, Have an issue where a redirect pushes data to a page with a select case which then redirects to another page. Problem is the redirect isnt working in 1 case. Code below: strURL =...
8
by: | last post by:
Hello, This is gonna sound real daft, but how do I test a Select Case statement for variants of a theme? Here's a snippet of my code... Select Case sUsr Case "Guest", "TsInternetUser",...
14
by: Daron | last post by:
I am doing so data validation, and need to check if a filed contains a valid date in the format of "YYYY-MM-DD" I would like to know if it is possible to convert this series of If's to a Select...
2
by: scole954387 | last post by:
Hi, I have a problem. I have written a SQL statement that has a nested select case statement on the 'where' clause to condition the results. ...
1
by: microsoft.public.dotnet.languages.vb | last post by:
Hi All, I wanted to know whether this is possible to use multiple variables to use in the select case statement such as follows: select case dWarrExpDateMonth, dRetailDateMonth case...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.