Quick Fix: How to TRIM and CONVERT ???

  • Hi,

    How do I .... Before inserting data into a column, I need to first convert the type from varchar to numeric (so that I can perform calculations) and TRIM everyting after a blank is detected, including the blank. ie: '1024 KB' ---> 1024 

    Any quick code help is greatly appreciated. Thanks, Jeff

    Many thanks. Jeff

  • SELECT LEFT(YourCol,CHARINDEX(' ',LTRIM(YourCol)))

    WHERE LTRIM(YourCol) LIKE '% %'



    --Jonathan

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply