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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Error in 2005 from 2000! HELPPPP

Author  Topic 

raxbat
Yak Posting Veteran

52 Posts

Posted - 2008-07-19 : 06:26:35
Hello all!
After I upgrade my DB server from sql 2000 to 2005 I have got error when performing query:

SELECT STOP_sub.Valuta, CONVERT(float, STOP_sub.Nominals) AS Nominals, SUM(STOP_sub.Qnt) AS SumOfDaudzums FROM STOP LEFT OUTER JOIN Lietotaji ON STOP.Autors = Lietotaji.id LEFT OUTER JOIN STOP_sub ON STOP.id = STOP_sub.stop WHERE (STOP.Datums <= CONVERT(DATETIME,'2008-07-19 12:24:44',102)) AND (STOP.Datums >= CONVERT(DATETIME,'2008-07-19 00:20:00',102)) AND (STOP.Iegramatots=1) AND (STOP.ObjektaNr <> 'temp') AND (Lietotaji.Filiale = 'RL') and (STOP.Autors = 27) and (STOP.inkbanka='Hansabanka') GROUP BY STOP_sub.Valuta, CONVERT(float, STOP_sub.Nominals) HAVING (STOP_sub.Valuta = 'LVL') AND (SUM(STOP_sub.Qnt) >= 0) AND (CONVERT(float, STOP_sub.Nominals) >= 5)

Actually doesnt work CONVERT(float, STOP_sub.Nominals)
SQL2005 server reports:
Msg 8114, Level 16, State 5, Line 1
Error converting data type nvarchar to float.

But with SQL2000 all is fine!

Help me plz!

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-07-19 : 07:06:17
The code is parsing OK , have you tried CAST rather than CONVERT

Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-19 : 08:34:41
what is the value of STOP_sub.Nominals that cause the error ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-19 : 12:11:16
i think there's some data in STOP_sub.Nominals that cannot be converted to float(may be some noin numeric data)
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-07-22 : 01:57:33
What about using a CASE statement?

Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com
Go to Top of Page
   

- Advertisement -