Delete a record in a stored procedure
Posted on 2011-04-21
This is for a school project. I'm new at this and I'm short on time. If someone can help, I would appreciate it!
I am working in Visual Studio 2010, connected to a SQL Server database. I have a stored procedure that keeps giving me errors
This is the procedure:
ALTER PROCEDURE spDeleteExpenses
DELETE FROM Expenses
WHERE owner_id = ('+ @owner_id +')
AND date = ('+ @date +')
AND expense_type = ('+ @expense_type +')
This is what I see in the output window:
Running [spDeleteExpenses] ( @owner_id = 1, @date = 4/18/2011, @expense_type = Fuel ).
Operand type clash: date is incompatible with int
Invalid column name 'Fuel'.
No rows affected.
(0 row(s) returned)
@RETURN_VALUE = 0
Finished running [spDeleteExpenses].
If I take out the date and expense_type parameters, it runs fine. The columns in the database are of the same type as I have declared in the stored procedure.