我收到错误
Msg 102,Level 15,State 1,Procedure PROC_GMAPSDATA,Line 15
附近的语法不正确
')'
我的代码在这里:
CREATE PROCEDURE PROC_GMAPSDATA
(@DEVICENUMBER INT)
AS
BEGIN
DECLARE @DEVICEID INT
SET @DEVICEID = (SELECT DEVICEID
FROM DEVICEMASTER
WHERE DEVICENO = @DEVICENUMBER)
SELECT
REGISTRATIONNUMBER AS TRUCKNUMBER,
CURRENTLOCATION AS CURRENTLOCATION,
CURRENTLATLNG AS CURRENTLATLNG
FROM
TRUCKMASTER
WHERE
DeviceID IN (SELECT DEVICEID
FROM DEVICEMASTER
WHERE DEVICENO = @DEVICENUMBER)
GO
答案 0 :(得分:1)
我在您的存储过程中添加了以下更改。
一个)。已添加END
个关键字。
B)。使用值赋值变量@DEVICEID
C)。格式化更改。
CREATE PROCEDURE [dbo].PROC_GMAPSDATA
(
@DEVICENUMBER INT
)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @DEVICEID INT;
SET @DEVICEID =(
SELECT
DEVICEID
FROM [dbo].[DEVICEMASTER]
WHERE DEVICENO = @DEVICENUMBER
)
SELECT REGISTRATIONNUMBER AS TRUCKNUMBER,
CURRENTLOCATION AS CURRENTLOCATION,
CURRENTLATLNG AS CURRENTLATLNG
FROM [dbo].[TRUCKMASTER]
WHERE DeviceID = @DEVICEID
SET NOCOUNT OFF;
END
GO