我有這有一個問題一個sybase的存儲過程。問題與存儲過程
這裏如果我使用INSERT語句直接插入完美的作品 如圖所示:
insert
into dbo.StudentData
(studID
, studLetters
, studCode
, studTelecast
, studName
, monthCode
, reportDate
, startTime
, endTime
, startDateTime
, endDateTime
, cost
, duration
, creationTime
)
values
(113
, 'ABCD'
, 222
, 333
, 'One'
, 02
, getDate()
, getdate()
, getdate()
, getdate()
, getdate()
, 999
, 11
, getdate()
)
;
但是,如果使用存儲的過程,我發現了以下錯誤:
[EXEC - 0 row(s), 0.000 secs] [Error Code: 102, SQL State: 42000] Incorrect syntax near ')'.
exec dbo.sp_loadStudData(113, 'ABCD', 222, 333, 'One', 02, getDate(), getdate(), getdate(), getdate(), getdate(), 999, 11, getdate())
我我無法找出問題所在,但已成功創建存儲過程而沒有任何錯誤。 存儲的過程是FOLL:
create proc dbo.sp_loadStudData
(
@studID int,
@studLetters varchar(255),
@studCode int,
@studTelecast int,
@studName varchar(25),
@monthCode int,
@reportDate datetime,
@startTime datetime,
@endTime datetime,
@startDateTime datetime,
@endDateTime datetime,
@cost int,
@duration int,
@creationTime datetime
)
as
begin
set nocount on
insert into dbo.StudentData(studID,studLetters,studCode ,studTelecast ,studName ,monthCode,reportDate,startTime,endTime,startDateTime,endDateTime,cost,duration,creationTime)
values(@studID,@studLetters,@studCode ,@studTelecast ,@studName ,@monthCode,@reportDate,@startTime,@endTime,@startDateTime,@endDateTime,@cost,@duration,@creationTime)
end
go
EXEC sp_procxmode 'dbo.sp_loadStudData', 'unchained'
go
IF OBJECT_ID('dbo.sp_loadStudData') IS NOT NULL
PRINT '<<< CREATED PROCEDURE dbo.sp_loadStudData >>>'
ELSE
PRINT '<<< FAILED CREATING PROCEDURE dbo.sp_loadStudData >>>'
go
GRANT EXECUTE ON dbo.sp_loadStudData TO developers
go
GRANT EXECUTE ON dbo.sp_loadStudData TO web_group
go
GRANT EXECUTE ON dbo.sp_loadStudData TO crd_group
go
GRANT EXECUTE ON dbo.sp_loadStudData TO wd_group
go
也許你需要 ';'在插入語句之後..... @ creationTime); – bAN 2013-04-25 12:15:30
由於這是最後一個接收參數,我一直以此結束。即使我使用它,它也會在創建過程時產生錯誤。 – 2013-04-25 12:17:54
在'開始設置'之前你需要嗎?而做ü也需要存儲過程的名稱後的開口(?在例子看這裏http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.sqlug/ HTML/sqlug/sqlug668.htm看起來像你不需要那些 – Edper 2013-04-25 12:20:27