Earlier I described a SQL Query to get the Full Path of an Altiris Job, today I will describe how we can make a User Defined Function (UDF) in SQL so we can call it easier.

I am using an UDF because it allows us to specify parameters, in this case a single parameter (the EventId (or job id).

This is the SQL that creates the UDF:

After you have executed this, you can find the UDF in the Programmability Section of SQL:

SqlProgSection

To call this UDF you need to use the two part name (dbo.GetFullPath) as described here.

Example:

UdfCallExample

Next step will be to prepend the \\SERVER\Share part which we can do in the UDF as well.