views:

35

answers:

2

I attached database from SQL Server 2000 to SQL Server 2005 and it worked well but I had column called (Add Date) which had the Date time of input data and when I insert new data after attached data base to SQL Server 2005 the new data insert with same data 12.00 also it converted all old date to 12.00.

Please anyone help me how I can solved this problem also how can retrieved old Date time ?

A: 

I would start of with the obvious first

  • Check the columns properties to make there there isn't any default value being applied
  • Change the database compatablity level to make sure its set to SQL Server 2005 (90)
    (Right click on database Properties > Options Tab)

EDIT:

If you wanting to formated what date gets inserted into the (Add Date) field you can use the CONVERT or CAST function.

kevchadders
what do you mean about •Check the columns properties to make there there isn't any default value being applied?
KareemSaad
in your table design, check the column called (Add Date), make sure there isn't anything in the Default Value or Binding.
kevchadders
I did all that you mentioned and what can I did cast function ,I had data type for field(Add_data) datetime
KareemSaad
A: 

solution 1: attach old database again, named it "old_bak" and then write t-sql like this:

UPDATE XX
SET col = T.col
WHERE
    XX.id = old_bak.dbo.XX.id

then the old data will retrieved!

solution 2: rollback your database from .bak file and execute your sql statement again

I doubt that your sql statement is "update", not "insert". or it won't be like that.

Tim Li
I cnnot understand you I had database called(HA),and column which have data date time inseration (Add_Date)
KareemSaad