Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 query

Author  Topic 

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2010-04-21 : 06:49:21
Hi,

how to change the datetime field into numeric field in sql server 2005 if data is there in that table.

Regards,
Rajasekhar.

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-04-21 : 06:54:18
After you changed to int what you want to store on the column? any datepart?

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

rajasekhar857
Constraint Violating Yak Guru

396 Posts

Posted - 2010-04-21 : 06:54:57
no numeric only
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-04-21 : 06:57:35
1.Copy the data to a temp_table.
2.update the datetime filed as NULL.
3.Alter the column as int.
4.Restore the data from temp_table

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page
   

- Advertisement -