Skip to main content
Inspiring
May 16, 2008
Question

"Invalid character value for cast specification"

  • May 16, 2008
  • 25 replies
  • 1623 views
"Invalid character value for cast specification."
MSSQL server 2000 - ASP


I get this when I try to connect to my Stored Procedure.

Through trial and error, I keep eliminating things that might cause this
error but I'm getting close to an empty box of things to look at.

I can post the Stored Procedure but given the error, I thought I'd ask
if there is something I should focus on first.

In a nutshell, the SProc pulls in variables from a form, checks if an
email exists, adds user if it doesn't fail and then returns some
variables if the transaction succeeds.
This topic has been closed for replies.

25 replies

Inspiring
May 27, 2008
Philo wrote:
>
> This is the way most of us learn. A little here, a little there, all
> at once you have arrived. I don't expect a shift away from sp's
> anytime soon, if fact I think they will become more common.

I never get that "arrive" thing that you mention. It's more like that
revolving door where you go in, spin around and before you know it,
you're heading out.
Inspiring
May 23, 2008

> I've gotten a number of books over the years that deal with SProcs
> and it seems that most show the technical side but fail to tie it all
> together in a way that people like me can use.

Excellent point. I have found a lot of the same. We need real word
examples from simple to moderately difficult with databases to work
with. I worked with Delphi for years and this was a complaint users
had but never really addressed by Borland.

>
> So far I've adapted to the slow evolution of all this but I fear that
> there's going to be a major paradigm shift that will leave me behind.
>

This is the way most of us learn. A little here, a little there, all
at once you have arrived. I don't expect a shift away from sp's
anytime soon, if fact I think they will become more common.



--

Inspiring
May 22, 2008
Dooza wrote:
> Art wrote:
>> Steve, I REALLY welcome your intent to do a tutorial on this. Care to
>> take on the challenge of authoring a book? If you need ideas I have a
>> few.
>
> A book? I find it hard enough finishing websites for friends, let alone
> a book, but maybe someone else here could? I dunno, this forum is pretty
> quiet compared a few years ago.

:) I know what you mean. Yes, this forum is pretty quiet.
>
> I too am surprised with the lack of information about stored procedures
> in general, not just how you use them with Dreamweaver.
>
> The first thing I need to get sorted is how to by pass Dreamweaver and
> write ASP for executing stored procedures. I need to show how to pass
> parameters in to the stored procedure, and how to output them to display
> on the page.
>
> Some of my basic stored procedures that just accept inputs and then
> return a recordset do work with Dreamweaver, so I will show some
> examples of those.
>
> I think a create user recordset is a good one to use as an example,
> where it first checks if they exist, if they don't then insert, but if
> they do, output a message saying they do exist.
>
> Any other ideas?
>
> Steve

I've found some good tutorials here

http://www.webthang.co.uk/goto/tutorials/tutorials.asp?cat=2
Inspiring
May 22, 2008
Philo wrote:
> There are some books that have sections on store procs
>
> The one I have is The Complete Reference SQL, Grpff & Wenberg,
> Osborne/McGraw Hill
>
> A google comes up with several including
> -Writing Stored Procedures for Microsoft SQL Server (Sams Professional)
> -Mysql Stored Procedure Programming, OReilly
> -SQL Server 2000 Stored Procedure Programming
>

Good sources, I'm sure.

I've gotten a number of books over the years that deal with SProcs and
it seems that most show the technical side but fail to tie it all
together in a way that people like me can use.

So far I've adapted to the slow evolution of all this but I fear that
there's going to be a major paradigm shift that will leave me behind.

I'll keep plugging away at this stuff.

Inspiring
May 22, 2008
There are some books that have sections on store procs

The one I have is The Complete Reference SQL, Grpff & Wenberg,
Osborne/McGraw Hill

A google comes up with several including
-Writing Stored Procedures for Microsoft SQL Server (Sams Professional)
-Mysql Stored Procedure Programming, OReilly
-SQL Server 2000 Stored Procedure Programming

Inspiring
May 22, 2008
Art wrote:
> Steve, I REALLY welcome your intent to do a tutorial on this. Care to
> take on the challenge of authoring a book? If you need ideas I have a few.

A book? I find it hard enough finishing websites for friends, let alone
a book, but maybe someone else here could? I dunno, this forum is pretty
quiet compared a few years ago.

I too am surprised with the lack of information about stored procedures
in general, not just how you use them with Dreamweaver.

The first thing I need to get sorted is how to by pass Dreamweaver and
write ASP for executing stored procedures. I need to show how to pass
parameters in to the stored procedure, and how to output them to display
on the page.

Some of my basic stored procedures that just accept inputs and then
return a recordset do work with Dreamweaver, so I will show some
examples of those.

I think a create user recordset is a good one to use as an example,
where it first checks if they exist, if they don't then insert, but if
they do, output a message saying they do exist.

Any other ideas?

Steve
Inspiring
May 21, 2008
Dooza wrote:
> Art wrote:
>> Dooza wrote:
>>
>>> I am going to attempt to create my own version over the next few days
>>> and see what I can make it do.
>>>
>>> Steve
>>
>> Wow! Thanks Hope you can get something out of this.
>
> This might be foundation of my first tutorial on Stored
> Procedures...that way everyone will get something from this.
>
> Steve
To everyone,

Somebody REALLY needs to write a book on this stuff. I can't be the only
one out here that needs this sort of help.

I'm not a programmer but I've been doing web design for about 12 years.
Still, I keep pealing layers of this metaphorical onion (programming)
that never ends. Stored Procedures, although they've been around for
most of my Web Design Career, are still a gap in my training. I've
attempted to learn it a few times in the past 10+ years but until last
year, I always got hung up on something that I couldn't get past. This
time I have gotten pretty far with SProcs; I'm not totally satisfied
with my results because everything is just pieced together and I'm sure
there must be best practices that I'm not following. Again, I don't know
what I don't know. A book would be great

And if a book was authored, I think the best format would be in the
format that the OReilly books use (Cookbook).

However, how do you write a book based, in part, on a program
(Dreamweaver CS3) that has a flaw in the Stored Procedure interface? By
the time the book is finished, they may or may not have fixed the bug so
how do technical authors get through that?

Even with this flaw, I think a book that guided people through the
strategies and details of using SProcs with Dreamweaver would be very
helpful to a lot of us.

Steve, I REALLY welcome your intent to do a tutorial on this. Care to
take on the challenge of authoring a book? If you need ideas I have a few.
Inspiring
May 21, 2008
Art wrote:
> Dooza wrote:
>
>> I am going to attempt to create my own version over the next few days
>> and see what I can make it do.
>>
>> Steve
>
> Wow! Thanks Hope you can get something out of this.

This might be foundation of my first tutorial on Stored
Procedures...that way everyone will get something from this.

Steve
Inspiring
May 21, 2008
Dooza wrote:

> I am going to attempt to create my own version over the next few days
> and see what I can make it do.
>
> Steve

Wow! Thanks Hope you can get something out of this.




Inspiring
May 21, 2008
Art wrote:
> So, I am now able to:
>
> 1. Check if user exists
> 2. Write to both tables if not
> 3. Redirect to a login page if the users registration succeeded
> 4. Redirect to Error page if registration failed.
>
> HOWEVER... The only way I could get this to work was to create a NEW
> recordset that did an INNER JOIN of the two tables (Customer ID on
> Shipping ID based on the Session ID).
>
> I would, ideally, want to pull it right out of the SProc that inserted
> the items in the first place but being a Designer, not a Programmer,
> this eludes me.
>
> Is this a legitimate way to do this?
>
> I'm not closing this but I guess I can now start to work through the
> rest of the site and come back to my original method when I figure it
> out. I think that's progress.

I had a good look at your code last night and I think your being too
complex, all that error checking as well as checking if the user already
exists seems like overkill to me.

I am going to attempt to create my own version over the next few days
and see what I can make it do.

Steve