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
 General SQL Server Forums
 New to SQL Server Programming
 Failed converting varchar value '-1' to data type

Author  Topic 

Lon
Starting Member

2 Posts

Posted - 2011-02-24 : 14:03:04
Hello! First post here. Somewhat of a newbie, please go easy on me.

I have an old banner rotation script that is now producing an error.

The error is as follows:

quote:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting the varchar value '-1' to data type bit.

/util_inc.asp, line 33



The code is as follows:
29. Function utility_executeCommand(strSQL)
30. Dim conDB
31. Set conDB = Server.CreateObject("ADODB.Connection")
32. conDB.Open DB_CONNECTION
33. conDB.Execute utility_convertSQL(strSQL), ,USD_adCmdText
34. conDB.Close
35. End Function
Hoping it's something obvious.

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2011-02-24 : 14:03:48
a bit is either 0 or 1. quit passing something else

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-02-25 : 09:12:27
Can you post the string assinged to strSQL?

See the difference


declare @bit bit
set @bit='-1'
select @bit

GO


declare @bit bit
set @bit=-1
select @bit


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Lon
Starting Member

2 Posts

Posted - 2011-02-26 : 15:11:57
The script is no longer producing the error and I can't get it to reproduce, weird. I'm also unable to determine which lines of code are responsible as there are over 500 lines. Guess I'll tackle it if it happens again. Thanks for the quick responses! Great forum!
Go to Top of Page
   

- Advertisement -