Home Dashboard Directory Help

SQLCMD: Includes with :r not working as expected by Manuel Bauer


 as Won't Fix Help for as Won't Fix

Sign in
to vote
Type: Bug
ID: 785538
Opened: 4/25/2013 12:19:03 AM
Access Restriction: Public
User(s) can reproduce this bug


When using a *.sql file containing the statement ":r .\MyScript.sql" in SSMS (SQLCMD Mode) the error message "The file specified for :r command was not found." is shown.

The same *.sql file works when I execute it in the T-SQL Editor of SSDT 2010 / 2012.
Sign in to post a comment.
Posted by Microsoft on 8/7/2013 at 5:44 PM
Thank you for your feedback. The issue described in SSMS is by design. File paths specified in SSMS using the :r comamnd should be specified with an absolute path.
Posted by Microsoft on 4/26/2013 at 12:34 AM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 4/25/2013 at 12:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by Microsoft on 8/7/2013 at 5:45 PM
Use absolute paths when specifying files with the :r SQLCMD command in SSMS.
File Name Submitted By Submitted On File Size  
MyScript.sql 4/25/2013 14 bytes
Main.sql 4/25/2013 17 bytes