Software Metering Console View – Part 5

The last change that we could make to this query is to use a table / view instead of a function. Many of you are now asking yourself which is better table or function? I think that they are about the same but I tend to use functions more because it allow me to do some logic within the function.

MICROSOFT WILL NOT SUPPORT THESE UPDATES!
Have said the prerequisite warning, keep in mind that MS might during service package or version upgrade might delete all objects from the db, therefore I recommend having a backup of all your custom queries, function, tables, etc.

Lets’ create our table and insert some data.
CREATE TABLE dbo.Language
(
   Langid varchar(100),
   LangDes varchar(250)
)
go

Insert into Language values(‘1029’ , ‘Czech’)
Insert into Language values(‘1033’, ‘English (United States)’)
Insert into Language values(‘65535’, ‘Any’)

 

sw5

Now we can access this table just like any other table / view.

 

sw5b

SELECT
 MPR.ProductName AS ‘Name’,
 MPR.OriginalFileName AS ‘Original File Name’,
 MPR.FileName AS ‘File Name’,
 MPR.FileVersion AS ‘Version’,
 Lang.LangDes as ‘Language’,
 MPR.SourceSite AS ‘Site’,
 case MPR.ApplyToChildSites
 when ‘1’ then ‘True’
 else ‘False’
 end as ‘Apply to Child Site’,
 case MPR.Enabled
 when ‘1’ then ‘True’
 else ‘False’
 end as ‘Enabled’,
 MPR.SecurityKey as ‘Rule ID’
FROM
 v_MeteredProductRule MPR,
 Language Lang
Where
 MPR.LanguageID = Lang.Langid

 

Leave a Reply

Your email address will not be published. Required fields are marked *