Ram Shankar Yadav's Blog!

My life's my passion!
posts - 165, comments - 361, trackbacks - 91

My Links

News


Microsoft Certified Professional Developer (MCPD) - .NET 2.0 Enterprise Application Development



Cheap Website Hosting - Free Domain

Twitter












Archives

Post Categories

Image Galleries

Blogs that I like most !

Sites that I like most !

SQL Server 2005: ISNULL with DateTime

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

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

Feedback

Gravatar

# re: SQL Server 2005: ISNULL with DateTime

can we give as SELECT ISNULL(<ColumnName>, 'Date is not entered') from <TableName> ??
8/10/2007 8:24 PM | sreejith
Gravatar

# re: SQL Server 2005: ISNULL with DateTime

>>can we give as SELECT ISNULL(<ColumnName>, 'Date is not entered') from <TableName> ??

You'll get nothing in return.
3/12/2008 10:37 PM | Joe Gakenheimer
Gravatar

# re: SQL Server 2005: ISNULL with DateTime

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 ...
9/7/2008 8:06 PM | vhincent
Gravatar

# re: SQL Server 2005: ISNULL with DateTime

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
10/31/2008 9:39 PM | scottz
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: