Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
((DT_NUMERIC,7,0)REPLACE(["Aggregate Total Space"]," TB","")) * 1024Friends I have a colum "aggregate total space" that comes in as a varchar(50). The values have word " TB" or " GB" or " MB" in them.I am trying to remove these words, and convert this into a numeric value for reporting.The default is GB. So if the data comes in as TB I multiply the result by 1024. if it comes in as MB then I divide it by 1024. If it comes in as a GB i just convert it and let it pass.When I run this command I get the following error.[Removing Reference for " GB" [108]] Error: An error occurred while attempting to perform a type cast.Can somebody help me?CheersParesh RegardsParesh MotiwalaBoston, USA
gbritton
Master Smack Fu Yak Hacker
2780 Posts
Posted - 2014-08-27 : 08:53:03
Don't quote the column name inside the brackets. This works for me
((DT_NUMERIC,7,0)REPLACE([Aggregate Total Space]," TB","")) * 1024