?
Solved

Report returning 01/01/1900 in field when date value is null

Posted on 2007-10-16
4
Medium Priority
?
424 Views
Last Modified: 2012-06-21
I have a query that provides data for a report one of the fields is a date type and will on occasion be empty, however when that is the case sql server returns the value '01/01/1900' I want the field to display nothing if there is no value
I tried  =iif(me.Value = 01/01/1900, " ","me.Value") without success
in the query I tried   ISNULL(sub.Date_Returned,'')as Date_Returned also without succes
0
Comment
Question by:deNZity
  • 2
  • 2
4 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 20088642
empty and NULL are not the same thing, especially not for date type...
now, with IIF() in the query, I assume you run the query on a linked table?
can you clarify?

0
 

Author Comment

by:deNZity
ID: 20088680
hi thanks for reply.

The iif() is in the report, We use reporting services so in the textbox that displays the date I created an
expression =iif(me.Value = 01/01/1900, " ","me.Value")

in the actual query that provides the datasource I used ISNULL(sub.Date_Returned,'')
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 20088714
what about this sql server expression:

CASE WHEN sub.Date_returned < convert(datetime,  '1901-01-01' , 120) then NULL ELSE sub.date_returned end date_returned
0
 

Author Comment

by:deNZity
ID: 20088742
Great stuff, thanks Angellll
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

850 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