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
 Date conversion validation

Author  Topic 

phong919
Starting Member

29 Posts

Posted - 2008-04-09 : 10:55:06
Hello all,

I was wondering if someone can assist me with the following date validation: i'm looking at somebody's sql and not sure what it means

CONVERT (varchar, dbo.tblSS_Milestone.dtBaselineStart, 101)

what does 101 mean?

Also can someone show me how i can check if there are nulls in the field and if there is, i would like to use another field with a value.

I'm not sure how to do that in sql server. Thank you.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-04-09 : 10:58:38
1. 101 denotes a format in which date will be converted in varchar - like mm/dd/yyyy, mm-dd-yyyy etc.

2. make use of ISNULL() or COALESCE()

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

phong919
Starting Member

29 Posts

Posted - 2008-04-09 : 11:01:28
Can you post a sample of how to use? I'm just learning as i go along. thank you for your reply.
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-04-09 : 11:02:59
[code]Select IsNull(Null-Column, Non-Null-column)
from Table[/code]



Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

phong919
Starting Member

29 Posts

Posted - 2008-04-09 : 11:19:29
how would i do that with a case function?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-09 : 11:21:47
CASE WHEN Null-Column IS NULL THEN Non-Null-column ELSE Null-column END
Go to Top of Page

phong919
Starting Member

29 Posts

Posted - 2008-04-22 : 15:55:34
Hello visakh16,

How can i also convert the date to the right format within the case statement above.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-04-22 : 16:44:35
Read about CAST & CONVERT in Books Online.
Every single format is described.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2008-04-22 : 17:08:26
Read the hint link in my sig

And let us know the details of what you want to do

It's hard when we have to play 20 questions

http://en.wikipedia.org/wiki/Twenty_Questions



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -