?
Solved

SQL Today's Date

Posted on 2003-02-21
4
Medium Priority
?
3,582 Views
Last Modified: 2008-01-09
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
Comment
Question by:Idfoxx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 7996264
I believe it is Date()  Unfortunately I don't have my SQL books here.

mlmcc
0
 
LVL 3

Accepted Solution

by:
patelgokul earned 100 total points
ID: 7997691
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
 
LVL 8

Assisted Solution

by:heskyttberg
heskyttberg earned 100 total points
ID: 7998249
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
 
LVL 5

Expert Comment

by:Tom Knowlton
ID: 9453604
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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question