Firstly, I am not a database administrator, and I have no (administrator) experience with SQL Server, so please use words with several syllables when answering ...
I am running SQL Server 2008 R2 and trying to write a Proof Of Concept script that sets up unallocated, bidirectional, transactional replication. I managed to configure the script from the MS website to work, now I'm trying to configure it for our needs. This includes dumping a bunch of values into variables.
I set SSMS to "SQLCMD mode" and all my variables are processed normally, except for one.
:setvar ReplicationDirectory 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQL2\MSSQL\repldata';
This gives me an error:
A fatal script error has occurred. Unsuitable syntax encountered during parsing: setvar
I narrowed my problem down to having spaces in the variable. According to what I read, this should work without problems. I tried replacing single quotes with double quotes (both normal grade and angular), but they all give me the same error.
I cannot find anything on the Internet that tells me how I should avoid the space character. All the articles I've seen say that if the string is in quotation marks, SSMS simply interprets everything that is between the pair of them as one string - regardless of the spaces.
Does anyone have any ideas?
I suppose I can change the value of a variable:
:setvar ReplicationDirectory 'C:\Progra~1\Micros~1\MSSQL10_50.SQL2\MSSQL\repldata';
But I would rather decide "why can't I use spaces?" problem.
Many thanks.
Tom
source
share