Solved

MS SQL Row Create Date

Posted on 2006-07-03
4
297 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
[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
  • 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 500 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
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…
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…

632 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