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)
 converting string

Author  Topic 

johnnyleenguyen
Starting Member

3 Posts

Posted - 2009-11-13 : 16:43:40
i have a question on how to convert the string '20091212.001' to an integer? I don't want anything from the period and to its right


thanks for the input

johnnyleenguyen
Starting Member

3 Posts

Posted - 2009-11-13 : 17:20:05
basically character string to int
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-11-13 : 17:30:00
Check the CONVERT() function in Books Online.
Go to Top of Page

johnnyleenguyen
Starting Member

3 Posts

Posted - 2009-11-13 : 17:41:56
i actually did some looking and came up with this

SELECT CAST(CAST('20091212.001' AS DECIMAL) AS INT)
Go to Top of Page
   

- Advertisement -