bamboozled by error message

M

Mike P

I am repeatedly getting the error message 'error converting datatype
varchar to bit'. I am passing a varchar variable to a stored procedure
(where it is also a varchar) and then trying to write it to a table
(where it is also a varchar). I have no idea why it is trying to
convert it to a bit, it is very puzzling. Has anybody else had an error
like this?
 
B

Bob Barrows [MVP]

Mike said:
I am repeatedly getting the error message 'error converting datatype
varchar to bit'. I am passing a varchar variable to a stored procedure
(where it is also a varchar) and then trying to write it to a table
(where it is also a varchar). I have no idea why it is trying to
convert it to a bit, it is very puzzling. Has anybody else had an
error like this?
Yes, I have encountered this error, and every single time it was caused
by a mistake I made when writing either the stored procedure itself, or
my ADO code to execute the procedure. Every time.

Can you successfully run the procedure from Query Analyzer?

If so, then it's a problem with your ADO code, which you should post
along with the "CREATE PROCEDURE ... AS" section of your procedure
creation script (we don't need to see the entire script in this case).
See here for my recommended method for executing procedures via ASP/ADO:
http://groups.google.com/group/microsoft.public.inetserver.asp.general/msg/5d3c9d4409dc1701?hl=en

If not, it is a problem with the stored procedure itself, whose script
you should post. If you can whittle everything out of the precedure
except the part that raises the error, that would be helpful, not only
for us but you as well: going through that exercise might help you spot
the problem yourself.. We need to see the table creation DDL as well -
relevant portion only please.
 
M

Mike P

Thanks Bob...I will try to get something posted on here tomorrow as I am
now working on something else for the rest of the afternoon, but it
sounds likely...the code is very old code that I am having to support
that is a bit dodgy.
 
M

Mark J. McGinty

Mike P said:
I am repeatedly getting the error message 'error converting datatype
varchar to bit'. I am passing a varchar variable to a stored procedure
(where it is also a varchar) and then trying to write it to a table
(where it is also a varchar). I have no idea why it is trying to
convert it to a bit, it is very puzzling. Has anybody else had an error
like this?

If you're accessing the data via a view and any of the underlying tables
have changed since the view was created, you must recompile the view, either
by executing sp_recompile, or by changing the view (even in some meaningless
way, like adding a space to the end of its T-SQL statement) and saving it.

-Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,379
Messages
2,571,945
Members
48,806
Latest member
LizetteRoh

Latest Threads

Top