I am attempting to do a calculation in SQL Server 2008 R2 but I keep getting an error of
Msg 245, Level 16, State 1, Line 10
Conversion failed when converting the varchar value '.05' to data type int.
Altering table structure is not an option, is there a way I can alter the query so that this will succesfully execute?
DECLARE @Test1 TABLE
(
field1 VARCHAR(10),
field2 INT
);
INSERT INTO @Test1 ( field1, field2 )
VALUES ( '.05', 12 );
SELECT field1 / field2
FROM @Test1;