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 t开发者_StackOverflowo 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 ?
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.
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.
精彩评论