Execution Error | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Execution Error

Hello Everybody, I am facing one typical issue related to execution error. I am having two environment one is development and other is production.I am getting Execution error in production envrionment not in development when i am executing below query /**************Executing in Production Envrionment***********/ Declare @a money,
@b money SET @a=1 SELECT @b=(CONVERT(Money,ISNULL(@a,’0′))*100) Error Message:
Server: Msg 257, Level 16, State 3, Line 7
Implicit conversion from data type varchar to money is not allowed. Use the CONVERT function to run this query. /**************Executing in Development Envrionment***********/ Declare @a money,
@b money SET @a=1 SELECT @b=(CONVERT(Money,ISNULL(@a,’0′))*100) I am not getting any error, I know logic of converting ISNULL to ‘0’ in above query is wrong but it should display me the error in development envrionment.Is due to some database setting?. Please provide me your inputs. Thanks and Regards
Ravi K

-ravi,
you dont need this:
SELECT @b=(CONVERT(Money,ISNULL(@a,’0′))*100) change it to
SELECT @b=ISNULL(@a,0)*100 as the @a variable is declared as money

Hi ranjit, Thanks for your reply but my question is why i am not getting same error in both the envrionment.

Yes thats wierd.<br />Moderators can put some more focus on areas to investigate more on -<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />
]]>