Solved

Computed column

Posted on 2009-07-12
3
201 Views
Last Modified: 2012-05-07
Hello - I'm having trouble setting up a formula for a computed column in SQL Server 2000

I want to have a literal ">" with a particular date field when that date field contains a null. In the "Formula",  tried: CASE WHEN ISDATE(MyDateField) THEN '' ELSE '>' END
but this gets a syntax error.

(Doing this as a computed column in the table is a lazy fall-back to just doing it as an expression in a View, because the View Deigner in Enterprise Manager does not support CASE statements. If there is a better way, please tell me)

Thanks
0
Comment
Question by:mlagrange
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 24835301
it must be:
CASE WHEN ISDATE(MyDateField) = 1 THEN '' ELSE '>' END

Open in new window

0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 24835303
>I want to have a literal ">" with a particular date field when that date field contains a null.

CASE WHEN MyDateField IS NULL THEN '>' ELSE '' END

Open in new window

0
 

Author Comment

by:mlagrange
ID: 24835903
Great - Thanks!
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question