我无法使用存储过程存储日期数据类型变量。我的代码是:SQL Server 2008存储过程
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
如果我执行此过程它正在执行,但在日期类型变量中发生错误。它将错误提升为invalid item '-'
。
什么** EXACTLY **是错误信息?你在'@ Dob'参数中传递了什么样的值? –
你可能在低兼容性模式下运行数据库吗? – keithwarren7