Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3596
  • Last Modified:

SQL Today's Date

Hi,

I created a view... and I want the view to give me "Today's Date" if a certain date field is blank...
But I'm not sure how to tell the view to give me today's date.

WHEN dtApproved IS NULL THEN "??????" ELSE ' ' END AS DDate
0
Idfoxx
Asked:
Idfoxx
2 Solutions
 
mlmccCommented:
I believe it is Date()  Unfortunately I don't have my SQL books here.

mlmcc
0
 
patelgokulCommented:
use sysdate which returns current date and time.
[1]create view view_name where conditon
[2]update view_name
     set date_field=to_char(sysdate,format)where date_field is null
 
0
 
heskyttbergCommented:
Hi!

Just a comment:

sysdate is for Oracle.
date() is for MS SQL.

Remeber to always tell what DB you are using when asking such questions.

Regards
/Hans - Erik Skyttberg
0
 
Tom KnowltonWeb developerCommented:
Idfoxx,
No comment has been added lately (219 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:

RECOMMENDATION: split points between patelgokul http:#7997691 and heskyttberg http:#7998249

Please leave any comments here within 7 days.

-- Please DO NOT accept this comment as an answer ! --

Thanks,

knowlton
EE Cleanup Volunteer
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now