I would not normally use a function to execute code, but my boss is insisting on me using a function instead of an SP to execute SSIS packages. Don't really know why!
I need to create a function that will execute the following code and the user only need to provide the SSIS package name when calling the function.
declare @cmdtest varchar(200)
set @cmdtest = 'dtexec /f "C:\Users\Desktop\testpackage.dtsx"'
exec master..xp_cmdshell @cmdtest
This code above will execute my testpackage.dtsx, now my function must just ask for the SSIS package name and must be a varchar.
Since I am not clued up on functions can someone please show me what the best way of doing this is. I assume a Scalar Function needs to be used?