New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media: Improve Performance of GetMedia #3

Closed
hismightiness opened this Issue Aug 31, 2015 · 1 comment

Comments

Projects
None yet
1 participant
@hismightiness
Owner

hismightiness commented Aug 31, 2015

please use the following version for better performance:
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'{databaseOwner}[{objectQualifier}GetMedia]') AND OBJECTPROPERTY(id, N'IsPROCEDURE') = 1)
DROP PROCEDURE {databaseOwner}[{objectQualifier}GetMedia];
GO

CREATE PROCEDURE {databaseOwner}[{objectQualifier}GetMedia]
@ModuleID INT
AS
BEGIN
SET NOCOUNT ON;
SELECT m.[ModuleID],
m.[Alt],
m.[Width],
m.[Height],
{databaseOwner}{objectQualifier}FilePath AS Src,
{databaseOwner}{objectQualifier}FilePath AS NavigateUrl,
t.[NewWindow],
t.[TrackClicks],
m.[MediaAlignment],
m.[AutoStart],
m.[MediaLoop],
m.[NewWindow],
m.[TrackClicks],
m.[MediaType],
m.[MediaMessage],
m.[LastUpdatedBy],
m.[LastUpdatedDate]
FROM {databaseOwner}[{objectQualifier}Media] AS m
LEFT JOIN {databaseOwner}[{objectQualifier}UrlTracking] AS t ON m.[NavigateUrl] = t.[Url] AND t.[ModuleId] = @ModuleID
WHERE m.[ModuleId] = @ModuleId;
SET NOCOUNT OFF;
END
GO

@hismightiness

This comment has been minimized.

Show comment
Hide comment
@hismightiness
Owner

hismightiness commented Jul 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment