While implementing the procedure I am getting error as
Msg 156, Level 15, State 1, Procedure GET_USER_REPORT_DATA, Line 19 Incorrect syntax near the keyword 'select'.
Msg 102, Level 15, State 1, Procedure GET_USER_REPORT_DATA, Line 23 Incorrect syntax near ')'.
Here is the procedure
ALTER PROCEDURE [dbo].[GET_USER_REPORT_DATA]
@From_Date datetime,
@To_Date datetime
AS
BEGIN
Select * into #GetUserTable
from
(
select distinct a.N_UserMkey, b.mkey,
ISNULL(b.first_name + ' ' , '') + ISNULL(b.last_name,'') NAME
from inward_doc_tracking_trl a inner join user_mst b on
a.N_UserMkey = b.mkey
where a.U_datetime between @From_Date and @To_Date
select distinct a.mkey, b.ref_mkey from inward_doc_tracking_hdr a inner join
inward_doc_tracking_trl b on
a.mkey = b.ref_mkey
and a.U_datetime between @From_Date and @To_Date
) as xx
SELECT * FROM #GetUserTable
DROP TABLE #GetUserTable
END
Aucun commentaire:
Enregistrer un commentaire