SQL Server 2008 Stored Procedure

Posted by user238319 on Stack Overflow See other posts from Stack Overflow or by user238319
Published on 2010-02-01T18:14:21Z Indexed on 2010/05/09 20:28 UTC
Read the original article Hit count: 197

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 '-'.

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about sql-server-2008