?
Solved

converting timestamp to datetime

Posted on 2006-10-27
7
Medium Priority
?
1,293 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 100 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

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

In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Suggested Courses

757 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