473,320 Members | 1,947 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,320 software developers and data experts.

multiple case inside of each other

4
Hi, how I can create a column with case when I need another case in "then"; here is my problem: fyi, tyear is 4 diget and year is 2 diget; what I'm doing wrong?
Expand|Select|Wrap|Line Numbers
  1. [Year]= case when isnull(t.status,'') <> 4   
  2. then case when rigth(t.[Year],2)< rigth(t.[tYear],2)
  3. then 
  4. when t.[Year] <= 12 
  5. then '20'+t.[Year] 
  6. else '19'+t.[Year] 
  7. end                     
  8. else t.[tYear]
  9. end
  10. from table
Feb 19 '13 #1
3 1392
Rabbit
12,516 Expert Mod 8TB
Line 2, you spelled right incorrectly.

Line 3, you need an expression after your then, you can't go directly into another when regardless of whether or not you're using nested cases.
Feb 19 '13 #2
sqlfzk
4
oops, thanks for you info.
Feb 19 '13 #3
NeoPa
32,556 Expert Mod 16PB
The important point to note here is that you can happily nest CASE statements as long as you follow the syntax correctly.
Feb 19 '13 #4

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

Similar topics

2
by: Gizmo | last post by:
hi all i have a bit of a prob with some 2 classes iv created if say i have class A and class B. class A hold an atribute of class B and class be Holds an Atribute of class A. both are...
4
by: ckpun1978 | last post by:
Hi, I am now designing a program related to "graph". In particular, I would like to have 2 objects. #1. node #2. branch
7
by: ale.of.ginger | last post by:
Another question: I am writing a sudoku solving program. The 'solving' part of is just multiple iterations. It will take random numbers and keep switching it all around until a set of logic...
5
by: Rick | last post by:
Hi, Another question for today, it's about structs refering to each other. I tried this code struct List; struct child { struct List parent; };
2
by: Shashi | last post by:
My development environment is ASP.Net 1.1. When the user does multiple logins to the system and navigates to different screens and clicks back button sometimes it reading the session variables...
3
by: Henrik Dahl | last post by:
Hello! From default, the ASPNET user is giving the process identity for the ASP.NET runtime environment of IIS, however it's possible to change the user by modifying the <processModel> element...
7
by: Manuel Bleichner | last post by:
Hello list, I have searched for some time now, but no result... I'm having the following problem: In a module I have a huge number of classes of the form: class A(object): connected_to = ...
6
by: Andre | last post by:
How do I declare 2 structures in the same header file that have pointer to each other? struct A { struct B * b; }; struct B {
0
by: removeps-groups | last post by:
Now I'm wondering how to display 3 elements next to each other. I came up with the following solution using float:left, but would like opinions if this is the right way to go. The idea is to...
9
by: JackieSmith | last post by:
I have 2 option boxes with 3 radio buttons on each of them. They are deigned to fitler my subform depending on the selections. They both work great independently but neither work together. The...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.