Solved

Computed column

Posted on 2009-07-12
3
213 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

728 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