ALTER PROCEDURE [dbo].[sproc_dashboard_select_notifications]
@UserID int
AS
SET NOCOUNT ON;
CREATE TABLE #TempNotifications
(
ID int IDENTITY,
notificationID int,
notificationDate datetime,
notificationGroupName varchar(250),
processStepID int,
coID varchar(50),
suiteID int,
leaseID int,
assetID int,
woID int,
notificationRelatesTo varchar(250)
)
-- Save all applicable notifications to a temp table
INSERT INTO #TempNotifications (notificationID, notificationDate, notificationGroupName, processStepID, coID, suiteID, leaseID, assetID, woID)
SELECT notificationID, notificationDate, notificationGroupName, processStepID, coID, suiteID, leaseID, assetID, woID
FROM tblNotifications
JOIN tblNotificationGroupLevel ON tblNotifications.notificationGroupLevelID = tblNotificationGroupLevel.notificationGroupLevelID
JOIN tblNotificationGroup ON tblNotificationGroupLevel.notificationGroupID = tblNotificationGroup.notificationGroupID
WHERE tblNotifications.userID = @UserID AND notificationStatus = 0
SELECT *
FROM #TempNotifications
ORDER BY notificationDate ASC, notificationGroupName ASC
SET NOCOUNT OFF;
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.