Home Dashboard Directory Help
Search

SQL Server Agent token for Data Path by Ola Hallengren


Status: 

Closed


16
0
Sign in
to vote
Type: Suggestion
ID: 775024
Opened: 12/22/2012 12:17:26 PM
Access Restriction: Public
1
Workaround(s)
view

Description

There is a SQL Server Agent token for the SQL Server installation path (SQLDIR).

I would like to have a SQL Server Agent token for the SQL Server Data Path (SQLDATADIR).

The usage for that is logging to the SQL Server log directory in output - files.

$(ESCAPE_SQUOTE(SQLDATADIR))\Log
Details
Sign in to post a comment.
Posted by Sethu Srinivasan on 1/28/2014 at 3:48 PM
Shawn,
Fix is available in SQL 2014 CTP2 . You can create a SQL 2014 CTP2 Virtual machine from http://www.windowsazure.com/en-us/campaigns/sql-server/

Thanks
Sethu Srinivasan [MSFT]
SQL Server

Posted by Shawn Crocker on 1/22/2014 at 12:51 AM
Was it ever tested? Why is this closed?
Posted by Ola Hallengren on 5/14/2013 at 2:03 AM
I would be happy to test this. Please let me know about the details how to test it.
Posted by Microsoft on 5/14/2013 at 1:52 AM
Hello Ola Hallengren,
We have fixed this isse. Please let us know if you would be willing to validate the fix on your test environment
Thanks
Sethu Srinivasan [MSFT]
Posted by Ola Hallengren on 5/10/2013 at 3:28 AM
A token for the folder path of current SQL Server instance's error log folder path would be great. It would make it easy to configure an output - file to go to the log directory and it would make it easy to move jobs between sql server instances.

(The reason why I suggested SQLDATADIR was that I knew that was an option when you install an sql server. However a token for the sql server error log folder path would be even better.)
Posted by Sethu Srinivasan on 5/6/2013 at 6:32 PM
Hello Ola Hallengren,
If we were to add a new token that gives you the folder path of current SQL Server instance's error log folder path ( Example: C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Log ), will it help you in your scenario?

Connect feedback suggests us to add tokens for SQLDATADIR, Could you please clarify?


Thanks
Sethu Srinivasan [MSFT]
Posted by Ola Hallengren on 1/27/2013 at 4:55 AM
I would like to use it in the output file path for any type of job step.
http://msdn.microsoft.com/en-us/library/ms188952.aspx

Yes, you could query sys.dm_os_server_diagnostics_log_configurations to get the log path and and use that when you create the job, but then if you script out the job and create it on another sql server, the job will not work. Having a agent token for the log path would be a lot better.
Posted by Sethu Srinivasan on 1/21/2013 at 5:07 PM
Please let us know the type of Agent jobs you are using ( T-SQL / Powershell / SSIS /... )

Thanks
Sethu Srinivasan [MSFT]
SQL Server
Posted by Sethu Srinivasan on 1/21/2013 at 5:05 PM
You could get SQL Server Log path using following query

DECLARE @logpath nvarchar(MAX)
SELECT TOP 1 @logpath = [path]
FROM sys.dm_os_server_diagnostics_log_configurations
SELECT @logpath

This approach would help if you have a T-SQL jobstep


Thanks
Sethu Srinivasan [MSFT]
SQL Server
Sign in to post a workaround.
Posted by Sethu Srinivasan on 1/21/2013 at 5:06 PM
If you are using T-SQL job step, you could use the following approach to get the log folder path

DECLARE @logpath nvarchar(MAX)

SELECT TOP 1 @logpath = [path]
FROM sys.dm_os_server_diagnostics_log_configurations

SELECT @logpath

Thanks
Sethu Srinivasan [MSFT]
SQL Server