Ram Shankar Yadav's Blog!

My life's my passion!

  Home  |   Contact  |   Syndication    |   Login
  157 Posts | 0 Stories | 308 Comments | 95 Trackbacks

News


Microsoft Certified Technology Specialist ( MCTS) - .NET 2.0 Windows Development
Microsoft Certified Professional

My Photo Ablum


Cheap Website Hosting - Free Domain

Archives

Post Categories

Image Galleries

Blogs that I like most !

Sites that I like most !

ISNULL is a convenient default setter for a string column usually to empty string ''.

With a DateTime column you have to pick a characteristic date like the following:

 

SELECT ISNULL(<ColumnName>, '1900-01-01') from <TableName>

 

Happy Coding

posted on Monday, December 04, 2006 5:14 PM

Feedback

# re: SQL Server 2005: ISNULL with DateTime 8/10/2007 8:24 PM sreejith
can we give as SELECT ISNULL(<ColumnName>, 'Date is not entered') from <TableName> ??

# re: SQL Server 2005: ISNULL with DateTime 3/12/2008 10:37 PM Joe Gakenheimer
>>can we give as SELECT ISNULL(<ColumnName>, 'Date is not entered') from <TableName> ??

You'll get nothing in return.

# re: SQL Server 2005: ISNULL with DateTime 9/7/2008 8:06 PM vhincent
what do you mean you'll get nothing in return?

does it mean this is not possible or is there any alternative to display a different character instead of just '1900-01-01'

sorry if this is an old thread i'm asking in ...

# re: SQL Server 2005: ISNULL with DateTime 10/31/2008 9:39 PM scottz
you could technically use a convert() and change it over to a string and return 'Date not found' with the IsNull, but my advice would be to do that replacement on the code side

Post Feedback

Title:
Name:
Email: (never displayed)
Url:
Comments: 
Please add 4 and 8 and type the answer here: