Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Create Function

Author  Topic 

Baz_Singh
Starting Member

5 Posts

Posted - 2011-01-24 : 07:57:26
Hi All,

Would someone please be able to assist in writing a function which basically checks

if string is null then current_date

much appreciated

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2011-01-24 : 08:03:22
One already exists.... ISNULL([column],getdate())

To create a string of the current date ISNULL([column],convert(varchar(8),getdate(),112)



Poor planning on your part does not constitute an emergency on my part.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-01-24 : 09:02:10
Use coalesce. isnull depends on the datatype of parameter

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-01-24 : 10:24:31
see
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/10/04/isnull-or-coalesce.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -