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
 SQL Server Development (2000)
 Error in Stored Procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-07-02 : 09:12:06
Shaun writes "I have a insert SP that also saves a date value and all other values. The Date value is declared as DATETIME.

In my textbox I enter 1 April 2004 then it saves well and it saves it as 2004/04/01 as displays it like that, NO PROBLEM. My problem is when I change any other field like my name for example my SP executes and gives me a "Error converting data type varchar to datetime". It executes the SP like this = "EXEC sp_iEECommittee '{EFECB48C-942A-4FDF-AF3B-CE94C430CC98}', 6, '2974738', 'shaun roos', '31', '36', 'Management', 'Male', 'White', '2004/04/13', '6', 'African Male', 1"


Now I know that the single quotes makes the DATE a string value but why am I getting this then as a "Error converting data type varchar to datetime" error??

Please help!!"

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2004-07-02 : 09:16:50
Hi Shaun,
Are you calling a different proc to perform updates as to the one you use to insert?

If so, it might be that you are passing the parameters in an incorrect order as to what they are declared in the update proc.


Duane.
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-07-02 : 09:25:39
Why don't you show us your procedure so we can look at it. Is the input parameter for the procedure actually a datetime, or are you converting it in the procedures? My suggestion would be to use the format:

EXEC iEECommittee @date = '2004/04/13' plus whatever parameters you're passing in. Also, get rid of the sp_. YOu should never name stored procedures starting with sp_ unless it's a utility procedure that will be in the master database.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -