制作存储过程时出错。错误消息128,级别15,状态1 [英] error in making stored procedure . error Msg 128, Level 15, State 1

查看:79
本文介绍了制作存储过程时出错。错误消息128,级别15,状态1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 create procedure spuserdetails 
(@Name varchar(50),
@DOB datetime,
@Adrr varchar(70),
@phn int ,
@Country varchar(50),
@States Varchar(50),
@City varchar(50)

As
开始
insert into userdetails
values(Name = @ Name
DOB = @ DOB,
Addr = @ Addr,
phn = @ phn,
Country = @ Country ,
States = @ States,
City = @ City)
end



i有一个以下过程来插入所有值userdetails表。但执行错误即将发生:

消息128,级别15,状态1,过程spuserdetails,行13 
在此上下文中不允许使用名称名称。有效表达式是常量,常量表达式和(在某些上下文中)变量。不允许使用列名。

是什么原因?为什么它没有执行?

解决方案

你有语法错误。插入语句必须遵循以下格式:



  insert  进入 TABLENAME(FIELD1,FIELD2,...,FIELDN)(VALUE1,VALUE2,...,VALUEN)


create procedure spuserdetails
(@Name varchar(50),
@DOB datetime,
@Addr varchar(70),
@phn int,
@Country varchar(50),
@States Varchar(50),
@City varchar(50)
)
As 
Begin
insert into userdetails
values(Name=@Name
DOB=@DOB,
Addr=@Addr,
phn=@phn,
Country=@Country,
States=@States,
City=@City)
end


i have mage a following procedure to insert all the values in userdetails table. but on execution error is coming that:

Msg 128, Level 15, State 1, Procedure spuserdetails, Line 13
The name "Name" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.

what is the reason ? why it is not executing?

解决方案

You have a syntax error. Insert statements must follow this format:

insert into TABLENAME (FIELD1, FIELD2, ... , FIELDN) values (VALUE1, VALUE2, ... , VALUEN)


这篇关于制作存储过程时出错。错误消息128,级别15,状态1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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