Solved

converting timestamp to datetime

Posted on 2006-10-27
7
1,271 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction: I have seen many questions on EE and elsewhere, asking about how to find either gaps in lists of numbers (id field, usually) ranges of values or dates overlapping date ranges combined date ranges I thought it would be a good …
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
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…

896 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