Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MS SQL Row Create Date

Posted on 2006-07-03
4
Medium Priority
?
299 Views
Last Modified: 2012-06-21
Dear Sir,

I have create in my table one column namely JobOpenDate, I want SQL server automatically insert date when, in which date row was create for which I have used following commands on formula column (convert(varchar(10),getdate(),111)), filed name is ODate Datatype is varchar(10).

But every day its take current date and insert in the column instead of just show only row create date.

Rgds.
Iqbal
0
Comment
Question by:Mehram
  • 2
  • 2
4 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 17035120
You are using the Formula property this is intended for computed columns.  You need to use the Default property and if JobOpenDate is a datetime column just use GETDATE()
0
 

Author Comment

by:Mehram
ID: 17035123
Sir, when I am using this it is also taking time, which is not required in my case. Please help.
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 2000 total points
ID: 17035141
Ok.  If the JobOpenDate is a datetime and you do not need the time than you can place the following in the Default attribute:
CAST(CONVERT(char(10), GETDATE(), 120) as datetime)

If on the other hand the database is varchar(10) and you want it with the Japan style than use:
CONVERT(char(10), GETDATE(), 111)
0
 

Author Comment

by:Mehram
ID: 17035157
Sir, Thanks my problem resolved.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

972 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