Solved

converting timestamp to datetime

Posted on 2006-10-27
7
1,268 Views
Last Modified: 2012-05-11
I have collumn data with timestamp value, and when i try to insert into datetime column, its throwing error as:

Msg 260, Level 16, State 1, Server SYS_034, Procedure TD_History, Line 17
Disallowed implicit conversion from data type datetime to data type timestamp, table 'MASTER.dbo.AUD_History', column 'DateRealisation'. Use the CONVERT function to run this query.

hOPE you will have immed solution.

Thanks in adv..
~ HNS ~
0
Comment
Question by:homnath_sharma
  • 4
  • 2
7 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 50 total points
ID: 17818671
A timestamp column in SQL Server has nothing to do with date or time, this is more like a sequential number rather than a datetime value
0
 

Author Comment

by:homnath_sharma
ID: 17818880
Aneesh,

I need to insert datetime column data of one table into  timestamp column field in another table.

Regds.
~ HNS ~
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 17818895
You dont have to specify the value in the Timestamp column explicitly, it will be inserted/modified automatically with the insert/update operation
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:homnath_sharma
ID: 17818925

See,

I am trying to insert value at runtime thru trigger as below:

create trigger hist
on DBO.XXX_History
instead of delete
as
begin
INSERT INTO DBO.AUD_History SELECT d.DateRealisation from deleted d.
end

AUD_History.DateRealisation is of type (timestamp)
XXX_History.DateRealisation is of type (datetime)

Error is as:
Disallowed implicit conversion from data type datetime to data type timestamp, table 'Expert.dbo.AUD_History', column 'DateRealisation'. Use the CONVERT function to run this query.


Regd.s
~ HNS ~
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 17819807
can you post the table structure
0
 
LVL 16

Expert Comment

by:TSmooth
ID: 17820021
I think you're going to have to change your data structure to change the data type of that field or add an additional field. From SQL Books Online:

"The SQL Server timestamp data type has nothing to do with times or dates. SQL Server timestamps are binary numbers that indicate the relative sequence in which data modifications took place in a database. The timestamp data type was originally implemented to support the SQL Server recovery algorithms."

"Never use timestamp columns in keys, especially primary keys, because the timestamp value changes every time the row is modified."

Why is AUD_History.DateRealisation of type timestamp?
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 17945886
Thanks for Grace "C"
Hope you need to go thru the User terms and conditions
http://www.experts-exchange.com/help.jsp#hi73
http://www.experts-exchange.com/help.jsp#hi18
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
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…

762 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

24 Experts available now in Live!

Get 1:1 Help Now