Solved

MS SQL Row Create Date

Posted on 2006-07-03
4
286 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Sir, Thanks my problem resolved.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In today’s complex data management environments, it is not unusual for UNIX servers to be dedicated to a particular department, purpose, or database.  As a result, a SAS® data analyst often works with multiple servers, each with its own data storage…
This article describes some very basic things about SQL Server filegroups.
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now