Quantcast
Channel: SQL Server Compact & SQLite Toolbox
Viewing all articles
Browse latest Browse all 2796

Closed Issue: Syntax error in generated schema diff [11203]

$
0
0
It seems that the script generated by "Script Database Diff..." has a small error when adding a column to a table.
I diff'ed my databases which had one table with two columns added. The generated script ("names changed to protect the innocent") is (without the comments):
```
ALTER TABLE [ATable] ADD [FooFloat] float NOT NULL DEFAULT 0.0 ;
GO
ALTER TABLE [ATable] ADD [BarBit] bit NOT NULL DEFAULT 1 ;
GO
```
The parse check for this passes, but executing this script gives:
```
Error Code: 80040E14
Message : There was an error parsing the query. [ Token line number = 1,Token line offset = 5,Token in error = ; ]
Minor Err.: 25501
Source : SQL Server Compact ADO.NET Data Provider
Num. Par. : 1
Num. Par. : 5
Err. Par. : ;
```
It appears the issue is that the __NOT NULL__ comes before the __DEFAULT _value___ in the statement.
I rearranged it:
```
ALTER TABLE [ATable] ADD [FooFloat] float DEFAULT 0.0 NOT NULL ;
GO
ALTER TABLE [ATable] ADD [BarBit] bit DEFAULT 1 NOT NULL ;
GO
```
and it works correctly.
Comments: In 3.6

Viewing all articles
Browse latest Browse all 2796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>