sethreno / schemazen

Script and create SQL Server objects quickly
MIT License
333 stars 140 forks source link

Error when trying to _script_ Database on MS SQL Server Standard 11.0.7001.0 #166

Open thfrei opened 5 years ago

thfrei commented 5 years ago

Error description

I try to script an export of a database as seen below. However this fails for unknown reasons:

PS C:\apps> .\SchemaZen.exe script --verbose --server=SERVER --database=MES20 --user=USER--pass=PW --scriptDir=c:\temp
\MES20 -o
Loading database schema...

Must declare the scalar variable "@roleName".
Must declare the scalar variable "@roleName".
Incorrect syntax near '+'.
Incorrect syntax near '+'.
Incorrect syntax near '+'.
Incorrect syntax near '+'.
Incorrect syntax near '+'.
Incorrect syntax near '+'.
Incorrect syntax near '+'.
Incorrect syntax near '+'.
Incorrect syntax near '+'.
Incorrect syntax near '+'.
Incorrect syntax near '+'.
Incorrect syntax near '+'.
Incorrect syntax near '+'.

'Script' - Generate scripts for the specified database.

Expected usage: SchemaZen.exe Script <options>
<...

PS C:\apps>

-v Does not give me more information unfortunately.

The Server properties are below:

Edition ProductVersion  ProductLevel
Standard Edition (64-bit)   11.0.7001.0 SP4

Note: When using an SQL Express Server (The Same DB MES20 was backed up from the server and restored to SQL Express) it works.

It might be related to #141 however, I am not using SQL Express in this case, and I get another error.

Any suggestions?

Please let me know, if I can give you more details. Thank you.

timur4000 commented 5 years ago

I have exactly the same error! MS SQL Server 2014 Developer Edition

thfrei commented 5 years ago

I figure it has something to do with Server Versions. As of MS SQL Server 2016 (13.x) it seems to work.

techvslife commented 4 years ago

As of MS SQL Server 2019, getting the same error!

spochiero commented 3 years ago

pb in database.cs the variable is declared like this : @RoleName and not like this : @roleName

in your case, the SQL Server classement is case sensitive