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 converting data type varchar to float??

Author  Topic 

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2009-04-14 : 11:08:13
Since paymentID is a varcahr field, why am I getting a

Error converting data type varchar to float.


declare @T1 table (paymentID varchar(50))

insert into @T1(PaymentID)
select '12321' union all
select 'NO Check' union all
select '23232' union all
select '2321'



Select *
from
@T1 a
where
REPLACE(STR(a.PaymentID,20, 0), ' ', '0') = '12321'




Success is 10% Intelligence, 70% Determination, and 22% Stupidity.
\_/ _/ _/\_/ _/\_/ _/ _/- 881

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2009-04-14 : 11:11:25
The issue was obvious... one of those days, I was trying to convert a varchar that was supposed to be numeric to a string. Obviously I can't convert 'No Check' to a number... I need a vacation :)


Success is 10% Intelligence, 70% Determination, and 22% Stupidity.
\_/ _/ _/\_/ _/\_/ _/ _/- 881
Go to Top of Page
   

- Advertisement -