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 2000 Forums
 Transact-SQL (2000)
 Help with a stored procedure.

Author  Topic 

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2005-07-25 : 12:37:07
I have a stored procedure on my mSQL 2k server which reads this:
create proc new_registrations (@uid char, @pass char, @charactername char, @realname varchar, @email varchar) as
insert into requested (uid, pass, charactername, realname, email) values (@uid, @pass, @charactername, @realname, @email)
return

To call that procedure and pass data to it I use a perl script that has this line of code:

$sth = $dbh -> prepare (q~execute new_registrations uid, pass, charactername, realname, "email@mail.com"~) or die "Could not prepare statement: $DBI::errstr; stopped";
$sth -> execute() or die "Could not execute SQL statment: $DBI::errstr; stopped";


Now when I run the script it runs and puts the data intothe database, but the problem is it only puts the first letter of each entry in. So when I vew the data it looks like this:

u, p, c, r, e

What am I screwing up to cause the DB only to get the first letter of each entry?

--
For those with wings, fly to your dreams

Dearms are what are found at the end of reality, and your reality if what is found at the end of your dreams.

jhermiz

3564 Posts

Posted - 2005-07-25 : 13:14:25
well you need to use varchar(insert number here) or char(insert number here)

The default is one so you need to tell it how long the string is going to be.






Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2005-07-25 : 13:14:42
your stored procedure is receiving a char(1) variable, which is 1 character. You need to define the length of each variable.



Corey

Co-worker on The Wizard of Oz "...those three midgets that came out and danced, the freaked me out when I was little. But they are ok now."
Go to Top of Page

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2005-07-25 : 13:32:25
I thought it was something like the char size not beeing set but my SAMs T-SQL did not cover doing that so I was not sure how. Will try again. Thanks.

Moded the proc and all is working now. Thanks!

--
If I get used to enving others...
Those things about my self I pride will slowly fade away.
-Stellvia
Go to Top of Page
   

- Advertisement -