G
Guest
I am running SQL Server 2000 and VB .Net. I would like to update a timestamp field (called customer_timestamp) I have in my Customer table using a stored procedure. I am calling the stored procedure and using the values from a datatable to update my Customer table. I have defined a variable in my stored procedure called @@Now that I am setting to the value of GETDATE(). I am then using @@Now in my values clause to set the value of my customer_timestamp field, but when I execute the stored procedure I get an error: Procedure 'SpInsertDetail' expects parameter '@customer_timestamp', which is not supplied. I don't understand why it is not accepting @@Now as the value
Here the store procedure code
CREATE PROCEDURE dbo.spInsertDetail (@customer_lname varchar(25)
@customer_fname varchar(20), @customer_mi char(4), @customer_suffix char(4)
@customer_companyName varchar(50), @customer_attn varchar(25)
@customer_street1 varchar(50), @customer_street2 varchar(25)
@customer_city varchar(20), @customer_state char(2), @customer_zip char(9)
@customer_country varchar(25), @customer_phone char(10), @customer_ext char(5)
@customer_phoneAlt char(10), @customer_phoneAltExt char(5), @customer_homePhone char(10)
@customer_fax char(10), @customer_cell char(10), @customer_emailAddress varchar(40)
@customer_notes ntext, @customer_commissionPercentage int, @customer_timestamp smalldatetime,
@customer_id int output
AS SET NOCOUNT OFF
DECLARE @ErrorCode in
DECLARE @@Now datetim
SET @@Now = GETDATE(
BEGIN TRA
Insert into tblCustome
(customer_lname, customer_fname, customer_mi, customer_suffix
customer_companyName, customer_attn, customer_street1, customer_street2
customer_city, customer_state, customer_zip, customer_country, customer_phone
customer_ext, customer_phoneAlt, customer_phoneAltExt, customer_homePhone
customer_fax, customer_cell, customer_emailAddress, customer_notes
customer_commissionPercentage, customer_timestamp
Values(@customer_lname, @customer_fname, @customer_mi
@customer_suffix, @customer_companyName, @customer_attn, @customer_street1
@customer_street2, @customer_city, @customer_state, @customer_zip
@customer_country, @customer_phone, @customer_ext, @customer_phoneAlt
@customer_phoneAltExt, @customer_homePhone, @customer_fax, @customer_cell
@customer_emailAddress, @customer_notes, @customer_commissionPercentage, @@Now
SET @ErrorCode=@@ERRO
If (@ErrorCode <> 0
goto Erro
selec
@customer_id = @@Identity
/* check for error*
IF (@@ERROR <> 0
GOTO Erro
GOTO O
Error
/* Error Condition, so rollback*
ROLLBACK TRANSACTIO
RETURN -
GOTO Finally
Ok
/*Everything is ok, so commit*
COMMIT TRANSACTIO
RETURN
Finally
G
Here the store procedure code
CREATE PROCEDURE dbo.spInsertDetail (@customer_lname varchar(25)
@customer_fname varchar(20), @customer_mi char(4), @customer_suffix char(4)
@customer_companyName varchar(50), @customer_attn varchar(25)
@customer_street1 varchar(50), @customer_street2 varchar(25)
@customer_city varchar(20), @customer_state char(2), @customer_zip char(9)
@customer_country varchar(25), @customer_phone char(10), @customer_ext char(5)
@customer_phoneAlt char(10), @customer_phoneAltExt char(5), @customer_homePhone char(10)
@customer_fax char(10), @customer_cell char(10), @customer_emailAddress varchar(40)
@customer_notes ntext, @customer_commissionPercentage int, @customer_timestamp smalldatetime,
@customer_id int output
AS SET NOCOUNT OFF
DECLARE @ErrorCode in
DECLARE @@Now datetim
SET @@Now = GETDATE(
BEGIN TRA
Insert into tblCustome
(customer_lname, customer_fname, customer_mi, customer_suffix
customer_companyName, customer_attn, customer_street1, customer_street2
customer_city, customer_state, customer_zip, customer_country, customer_phone
customer_ext, customer_phoneAlt, customer_phoneAltExt, customer_homePhone
customer_fax, customer_cell, customer_emailAddress, customer_notes
customer_commissionPercentage, customer_timestamp
Values(@customer_lname, @customer_fname, @customer_mi
@customer_suffix, @customer_companyName, @customer_attn, @customer_street1
@customer_street2, @customer_city, @customer_state, @customer_zip
@customer_country, @customer_phone, @customer_ext, @customer_phoneAlt
@customer_phoneAltExt, @customer_homePhone, @customer_fax, @customer_cell
@customer_emailAddress, @customer_notes, @customer_commissionPercentage, @@Now
SET @ErrorCode=@@ERRO
If (@ErrorCode <> 0
goto Erro
selec
@customer_id = @@Identity
/* check for error*
IF (@@ERROR <> 0
GOTO Erro
GOTO O
Error
/* Error Condition, so rollback*
ROLLBACK TRANSACTIO
RETURN -
GOTO Finally
Ok
/*Everything is ok, so commit*
COMMIT TRANSACTIO
RETURN
Finally
G