这有什么不对 [英] what is wrong in this

查看:83
本文介绍了这有什么不对的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

INSERT INTO [new].[dbo].[page2]
           ([Name]
           ,[City]
           ,[State]
           ,[Phone]
           ,[Salary]
           ,[Age]
           ,[Gender])
     VALUES
           (<name,>
           ,<city,>
           ,<state,>
           ,<phone,>
           ,<salary,>
           ,<age,>
           ,<gender,>)
GO

CREATE PROCEDURE dbo.InsertStudentsData
@Name varchar(35),
@City char(15),
@State char(15),
@Phone bigint(10),
@Salary int(15),
@Age Int(2)
@Gender char(20)
@IdentitY int OUTPUT
AS
BEGIN
INSERT Students (Name,City,[State],Phone,Salary,Age,Gender)
VALUES 
(@Name,@City,@State,@Phone,@Salary,@Age,@Gender)
END
SELECT @Identity = SCOPE_IDENTITY();
RETURN @Identity

推荐答案

代码在变量@Age和@Gender之后缺少逗号(,)。

代码的另一个问题是,你不能指定列宽到数据类型int和bigint代码应该是
The code is missing comma(,) after the variables @Age and @Gender.
Another problem with the code is, you cannot specify column width to data types int and bigint The code should be
CREATE PROCEDURE dbo.InsertStudentsData
@Name varchar(35),
@City char(15),
@State char(15),
@Phone bigint,
@Salary int,
@Age Int,
@Gender char(20),
@IdentitY int OUTPUT
AS
BEGIN
INSERT Students (Name,City,[State],Phone,Salary,Age,Gender)
VALUES 
(@Name,@City,@State,@Phone,@Salary,@Age,@Gender)
END
SELECT @Identity = SCOPE_IDENTITY();
RETURN @Identity


这篇关于这有什么不对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆