我有以下几点
stored-procedure
在里面
SQL server
.
我的代码如下:
CREATE PROCEDURE [dbo].[current_call]
-- Add the parameters for the stored procedure here
@user_id nvarchar(128)
AS
BEGIN
SET FMTONLY OFF
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE @LocUserId nvarchar(128)
SET @LocUserId = @user_id
-- Insert statements for procedure here
SELECT dbo.Call.call_id, dbo.Call.amb_id as ambulanceNum, dbo.Call.patient_number as patientId, dbo.Call.patient_age, dbo.Call.patient_sex as gender, dbo.Call.patient_phone, dbo.Call.caller_name, dbo.Call.call_received, dbo.Call.call_transfer, dbo.Call.call_response, dbo.Priority.name AS priorityName, dbo.Call_Status.name as Call_Status,
dbo.Station.station_name, dbo.City.city_name, dbo.Protocol.name AS protocolName
FROM dbo.City INNER JOIN
dbo.Call INNER JOIN
dbo.Priority ON dbo.Call.priority = dbo.Priority.priority_id ON dbo.City.city_id = dbo.Call.city INNER JOIN
dbo.Protocol ON dbo.Call.protocol_category = dbo.Protocol.id LEFT OUTER JOIN
dbo.Station INNER JOIN
dbo.Ambulance ON dbo.Station.station_id = dbo.Ambulance.ambulance_station ON dbo.Call.amb_id = dbo.Ambulance.ambulance_id
INNER JOIN
dbo.Call_Status ON dbo.Call.call_status = dbo.Call_Status.call_status_id
WHERE dbo.Call.user_id=@LocUserId and dbo.Call.call_status=2
SET FMTONLY ON
END
This is
查询计划。
有没有办法让它反应更快?