The View does not support Case Structure

accessman2

Registered User.
Local time
Yesterday, 16:53
Joined
Sep 15, 2005
Messages
335
SELECT Date, [Check] = CASE WHEN [Elec] = 'A' THEN 'T' ELSE 'Exe' END
FROM Employees

The View query does not support Case statement. Whereas Query Analyzer support it. In View, how can I make if statement over there?
 
This works fine:
Code:
use Northwind
GO

Create View NorthTemp AS
SELECT e.LastName, [Check] = CASE WHEN e.Region = 'WA' THEN 'T' ELSE 'Exe' END
FROM northwind.dbo.Employees e 
GO

select * from northwind.dbo.NorthTemp

GO
drop view NorthTemp
 
I've noticed a couple of instances where the View designer objects to things such as linked servers that will work just fine in Query Analyser. I can only suggest designing the View using the view designer if you want to and then using Query Analyser to actually create or amend the view.
 
I have used CASE statements in many views.
Will this not work?
SELECT Date, CASE WHEN [Elec] = 'A' THEN 'T' ELSE 'Exe' END as [Check]
FROM Employees
 
It will ... there is something else going on here, but Accessman2 never follows up with the results of what he gleans from here. :(
 
I'm sorry to hear that. I like to be able to see what works and what doesn't so that everyone can benefit.
 
Yeah, I do too. It is the reason Accessman2 has red jello (reputation). He doesn't play nice. :D
 

Users who are viewing this thread

Back
Top Bottom