Solved

MS SQL Row Create Date

Posted on 2006-07-03
4
294 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 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 Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
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…

685 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