Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Monday, June 27, 2011 7:29 AM
Hello,
I'm trying to crate one general sql file, that will run some sql files one by one.
SET NOCOUNT ON
GO
PRINT 'Start...'
:On Error exit
:r d:\a.sql
:r d:\b.sql
PRINT 'Finish...'
GO
Getting this error:
A fatal scripting error occurred.
Incorrect syntax was encountered while parsing :r .
SQLCMD mode is enabled.
Do you have any ideas what else should be done?
Thank you
Monday, June 27, 2011 9:04 AM ✅Answered
I believe found this, the file path contained spaces "d:\Documents and Settings\ had to move sqls and everything seems to be working fine.
Sorry for disturbing and thank you.
Monday, June 27, 2011 7:55 AM | 1 vote
I've just run this in SQL Server 2008 R2 and I get no errors.
SET NOCOUNT ON
GO
PRINT 'Start...'
:On Error exit
:r D:\Temp\a.sql
:r D:\Temp\b.sql
PRINT 'Finish...'
GO
My files containined Print 'a' and Print 'b'
Start...
a
b
Finish...
Jeff Wharton
MSysDev (C.Sturt), MDbDsgnMgt (C.Sturt) MCT, MCPD, MCITP, MCDBA
Blog: Mr. Wharty's Ramblings
Please mark solved if I've answered your question, vote for it as helpful to help other user's find a solution quicker
Monday, June 27, 2011 8:37 AM
1) I'm running it on MSSQL Server 2005 SP3. Maybe this is the issue?
2) Dou you know if line below takes a.sql from PC where Management Studio is started or from PC where SQL server has been installed?
:r D:\Temp\a.sql
Thank you
Monday, June 27, 2011 8:43 AM
1) I don't have a 2005 SP3 image however it ran successfully on 2005 SP4
2) From the PC SSMS is running on.
Jeff Wharton
MSysDev (C.Sturt), MDbDsgnMgt (C.Sturt) MCT, MCPD, MCITP, MCDBA
Blog: Mr. Wharty's Ramblings
Please mark solved if I've answered your question, vote for it as helpful to help other user's find a solution quicker
Monday, June 27, 2011 9:05 AM
I believe found this, the file path contained spaces "d:\Documents and Settings\ had to move sqls and everything seems to be working fine.
Sorry for disturbing and thank you.
No problem. At least you got it sorted outJeff Wharton
MSysDev (C.Sturt), MDbDsgnMgt (C.Sturt) MCT, MCPD, MCITP, MCDBA
Blog: Mr. Wharty's Ramblings
Please mark solved if I've answered your question, vote for it as helpful to help other user's find a solution quicker