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 bigint.

Author  Topic 

jmodiba
Starting Member

7 Posts

Posted - 2008-11-25 : 07:07:05
Hi

Can any one please help this cript is beign runnig on production environment for the past 2years without any errors but since yesterday i got this error

Error converting data type varchar to bigint.

please script below

SELECT
ct.ID,
convert(smalldatetime, substring(ct.Reference10,0,11), 120) as Reference10,
ltrim(rtrim(ct.Details)) as Details,
ct.Amount,
cb.AccountID
FROM
CashBookTransaction ct
inner join
CashBookBatch cb on ct.CashBookBatchID = cb.ID
inner join
Account a on cb.AccountID = a.ID
WHERE
a.DomainID = 2
and
ct.CashbookTransactionTypeID = 1
and
convert(bigint,ct.Reference6) = 1
and
isnumeric(ct.reference6) = 1
and
Reference5 = '-1'
and
ct.ReconID is null
ORDER BY
2,3,4,5

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-11-25 : 07:09:21
Already asked here http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=115146



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

jmodiba
Starting Member

7 Posts

Posted - 2008-11-25 : 07:43:42
The reference6 returns null values not varch
Go to Top of Page

jmodiba
Starting Member

7 Posts

Posted - 2008-11-25 : 07:44:14
The reference6 returns null values not varch
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-11-25 : 07:49:08
NULL is not a datatype. It is a special state or non-value for any datatype.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

jmodiba
Starting Member

7 Posts

Posted - 2008-11-25 : 08:06:35
sorry about my second respond i meant to say
the srcipt returns no values in the database that means there are no values to convert.
Go to Top of Page
   

- Advertisement -