Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


The Query Designer does not support the CASE SQL construct.


The Query Designer does not support the CASE SQL construct.

Author
Message
ritesh-385882
ritesh-385882
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 Visits: 38
when i copy this into a view it brings the following msg.

The Query Designer does not support the CASE SQL construct.

SELECT case ST.CurrentSickTerm
when 'LT' then 'Long Term'
when 'ST' then 'Short Term'
when '' then 'NULL'
END as SickTerm,

ST.CurrentSickTerm, SMS.Surname, SMS.Forenames, SMS.Title, SMS.[Job Title], SMS.SMSWard, SE.FirstDate, SE.LastDate,
SE.BaseWard, SE.PersonnelNumber, SE.BaseDirectorate, SE.SickCategory, SE.SickType, SE.SickReason, SE.IR1Number, SE.RIDDORDate,
SE.SickEpisodeID, SE.RTWInterview, SE.Deleted, HS.HospitalSiteDesc
FROM dbo.tblSicknessEpisode SE INNER JOIN
dbo.tblSMSStaff SMS ON SE.PersonnelNumber = SMS.[Personal Number] INNER JOIN
dbo.viewCurrentStaffSickTerms ST ON SE.PersonnelNumber = ST.[Personal Number] INNER JOIN
dbo.tblHospitalSite HS ON SE.BaseDirectorate = HS.HospitalSite
WHERE (SE.LastDate IS NULL) OR
(SE.LastDate >= '12/1/2006') AND (ST.CurrentSickTerm <> '') AND (SE.Deleted = 0)
ORDER BY SMS.Surname, SMS.Forenames, SE.FirstDate
Swashbuckler
Swashbuckler
Forum Newbie
Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: General Forum Members
Points: 8 Visits: 115
The 'funny' thing is that although Query Designer doesn't parse it, it is allowed in a View.

So, what I tend to do as a work around, is one of these 2 things:

1. Use a script to create your view, as shown in books online:

USE pubs
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS
WHERE TABLE_NAME = 'titles_view')
DROP VIEW titles_view
GO
CREATE VIEW titles_view
AS
SELECT title, type, price, pubdate
FROM titles
GO

2. Create and test the view in Query Analyser, then create a View in Enterprise Manager by adding in a simple table and selecting a field. Save it, open it up and paste the query into it (from SELECT down of course).

More info
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search