bamboozled by error message

bamboozled by error message

am 05.03.2007 16:24:37 von 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?



*** Sent via Developersdex http://www.developersdex.com ***

Re: bamboozled by error message

am 05.03.2007 16:48:46 von reb01501

Mike P wrote:
> 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.a sp.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.


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: bamboozled by error message

am 05.03.2007 17:57:59 von 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.


*** Sent via Developersdex http://www.developersdex.com ***

Re: bamboozled by error message

am 06.03.2007 04:25:05 von mmcginty

"Mike P" wrote in message
news:OSQojpzXHHA.688@TK2MSFTNGP03.phx.gbl...
>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


>
> *** Sent via Developersdex http://www.developersdex.com ***