SQL Server 2008 Stored Procedure
- by user238319
I cannot store the date data type variables using stored procedure. My code is:
ALTER PROCEDURE [dbo].[Access1Register]
-- Add the parameters for the stored procedure here
@MobileNumber int,
@CitizenName varchar(50),
@Dob char(8),
@VerificationCode int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
select CAST(@dob As DATE)
Insert Into Access1 (MobileNo,CitizenName,Dob,VerificationCode)
values(@MobileNumber,@CitizenName,@Dob,@VerificationCode)
go
If I exec this procedure it is executing, but there is an error occured in the date type variable. It's raising the error as invalid item '-'.