Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CAST or not to CAST
Message
 
 
To
03/07/2001 05:08:05
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00526174
Message ID:
00526211
Views:
13
According to BOL CONVERT/CAST is requred for decimal to decimal conversion when loss of precision or scale will occur. See 'CAST and CONVERT (T-SQL)' topic in BOL.


>Hi Again,
>
>I'm currently analysing stored procedures and come across the following (this is just an example):
>
>DECLARE @calc1 AS decimal(12,2)
>DECLARE @calc2 AS decimal(6,2)
>
>SET @calc1 = 123343.42
>SET @calc2 = 342.23
>
>CREATE TABLE ta1 (updcol decimal(12,2))
>
>UPDATE ta1 SET ta1.updcol = CAST(SUM(@calc1 * @calc2) AS decimal(12,2))
>
>I've run some test on using CAST and not using it, and I can see no difference in the results.
>
>Does anyone else know of an issue with me taking out the CAST, except maybe speeding the UPDATE up?
>
>Cheers
>Lee
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform