首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

急一个数据存储过程的有关问题

2012-01-24 
急,在线等!!!一个数据存储过程的问题我是一个数据存储方便做的新手,今天碰到一个问题,找了好久没有看出来,

急,在线等!!!一个数据存储过程的问题
我是一个数据存储方便做的新手,今天碰到一个问题,找了好久没有看出来,
还请高手指点,在线等!


SET   QUOTED_IDENTIFIER   ON  
GO
SET   ANSI_NULLS   ON  
GO

CREATE   PROCEDURE   kh_setup  
(
@kh_no   char   (8),                                  
@kh_name   char   (30),          
@kh_addr   char   (40),                                    
@yzbm   char   (6),                                    
@kh_tel   char   (40),
@kh_mobile   char   (50),
@user_name   char   (30),
@bz   char   (255)
)
  AS
insert   kh
(
kh_no,kh_name,kh_addr,yzbm,kh_tel,kh_mobile,user_name,bz
)
values
(
                @kh_no                                  
@kh_name      
@kh_addr                                  
@yzbm                                
@kh_tel  
@kh_mobile  
@user_name  
@bz  
)

GO

SET   QUOTED_IDENTIFIER   OFF  
GO
SET   ANSI_NULLS   ON  
GO

SET   QUOTED_IDENTIFIER   ON  
GO
SET   ANSI_NULLS   ON  
GO


/******   Object:     Stored   Procedure   dbo.kucun_setup         Script   Date:   2003-1-4   10:46:05   ******/

SET   QUOTED_IDENTIFIER   OFF  
GO
SET   ANSI_NULLS   ON  
GO

SET   QUOTED_IDENTIFIER   ON  
GO
SET   ANSI_NULLS   ON  
GO

CREATE   PROCEDURE   kpd_setup
(
@kpd_time   datetime,
@kpd_no   char   (8),
                @user_no   char   (8),
@user_name   char   (30),
@kh_name   char   (30),
@sp_no   char   (8),
                @sp_name   char   (30),
@num   numeric   (10),
@sp_price   numeric(12,   2),
@zkbl   numeric(5,   0),
@zje   numeric(12,   2),
@xj   char   (2),
@sq   char   (2)   ,
@bz   char   (100)
)
  AS
insert   kpd
(
kpd_time,
kpd_no,
user_no,
                user_name,
kh_name,
sp_no,
sp_name,
num,
sp_price,
zkbl,
zje,
xj,
sq,
bz
)
values
(

@kpd_time,
@kpd_no,
@user_no,
                @user_name,
@kh_name,
@sp_no,
@sp_name,
@num,
@sp_price,
@zkbl,
@zje,
@xj,
@sq,
@bz
)

GO
SET   QUOTED_IDENTIFIER   OFF  


GO
SET   ANSI_NULLS   ON  
GO

SET   QUOTED_IDENTIFIER   ON  
GO
SET   ANSI_NULLS   ON  
GO

CREATE   PROCEDURE     sp_setup
(
                @sp_no     char(8),
                @sp_name   char(30),
@sp_gg   char(30),
@sp_kiloprice   numeric(12,2),
@sp_price   numeric(12,2),
                @splb   char(30),
@bz   char(255)
)
    AS
insert   sp
(
sp_no,sp_name,sp_gg,sp_kiloprice,sp_price,splb,bz
)
values
(
@sp_no,@sp_name,@sp_gg,@sp_kiloprice,@sp_price,@splb,@bz
)

GO

SET   QUOTED_IDENTIFIER   OFF  
GO
SET   ANSI_NULLS   ON  
GO

SET   QUOTED_IDENTIFIER   ON  
GO
SET   ANSI_NULLS   ON  
GO

CREATE   PROCEDURE     user_setup
(
@user_no   char   (8),
@user_name   char   (30),
@dept_name   char   (30),
@user_pwd   char   (30)

)
    AS
insert   user
(
user_no,
user_name,
dept_name,
user_pwd,
user_time,

)
values
(
@user_no,
@user_name,
@dept_name,
@user_pwd,
@user_time,


)

GO
SET   QUOTED_IDENTIFIER   OFF  
GO
SET   ANSI_NULLS   ON  
GO

报错误信息如下:
服务器:   消息   170,级别   15,状态   1,过程   kh_setup,行   21
第   21   行:   '@kh_name '   附近有语法错误。
服务器:   消息   156,级别   15,状态   1,过程   user_setup,行   11
在关键字   'user '   附近有语法错误。


[解决办法]
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE kh_setup
(
@kh_no char (8),
@kh_name char (30),
@kh_addr char (40),
@yzbm char (6),
@kh_tel char (40),
@kh_mobile char (50),
@user_name char (30),
@bz char (255)
)
AS
insert kh
(
kh_no,kh_name,kh_addr,yzbm,kh_tel,kh_mobile,user_name,bz
)
values
(
@kh_no,
@kh_name,
@kh_addr,
@yzbm,
@kh_tel,
@kh_mobile,
@user_name,
@bz
)

GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


/****** Object: Stored Procedure dbo.kucun_setup Script Date: 2003-1-4 10:46:05 ******/

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE kpd_setup
(
@kpd_time datetime,
@kpd_no char (8),
@user_no char (8),
@user_name char (30),
@kh_name char (30),
@sp_no char (8),
@sp_name char (30),
@num numeric (10),
@sp_price numeric(12, 2),
@zkbl numeric(5, 0),
@zje numeric(12, 2),
@xj char (2),
@sq char (2) ,
@bz char (100)
)
AS
insert kpd
(


kpd_time,
kpd_no,
user_no,
user_name,
kh_name,
sp_no,
sp_name,
num,
sp_price,
zkbl,
zje,
xj,
sq,
bz
)
values
(

@kpd_time,
@kpd_no,
@user_no,
@user_name,
@kh_name,
@sp_no,
@sp_name,
@num,
@sp_price,
@zkbl,
@zje,
@xj,
@sq,
@bz
)

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE sp_setup
(
@sp_no char(8),
@sp_name char(30),
@sp_gg char(30),
@sp_kiloprice numeric(12,2),
@sp_price numeric(12,2),
@splb char(30),
@bz char(255)
)
AS
insert sp
(
sp_no,sp_name,sp_gg,sp_kiloprice,sp_price,splb,bz
)
values
(
@sp_no,@sp_name,@sp_gg,@sp_kiloprice,@sp_price,@splb,@bz
)

GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE user_setup
(
@user_no char (8),
@user_name char (30),
@dept_name char (30),
@user_pwd char (30),
@user_time char (30)

)
AS
insert [user]
(
user_no,
[user_name],
dept_name,
user_pwd,
user_time

)
values
(
@user_no,
@user_name,
@dept_name,
@user_pwd,
@user_time


)

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
[解决办法]
values
(
@kh_no
@kh_name
@kh_addr
@yzbm
@kh_tel
@kh_mobile
@user_name
@bz
)
需要逗号

user -> [user]

热点排行