lundi 1 décembre 2014

Default value for SQLCE 4.0 column


I am writing a tool to convert a system from XML data files into a SQLCE format. Not the most efficient way to do this, but essentially it will be digesting XML files created by another program, and I want to be able to use this tool to create a comparable DB from the files created externally.


What I discovered while writing it, is that when I went to parse column default constraints, I just single quoted everything quick and dirty, but it worked.


The end result is when I open the SDF in visual Studio, I see the column is of type integer, and the value is ('1')


were I creating it by hand I would put it in as (1), SQLCE does not seem to care either way, and when using the DB, not specifying the value does indeed yield a 1 in that column just as one would expect. It only seems wonky when looking at the table schema editor.


I will re-code my tool just because I do not like assumptions, and get it closer to what I would have done by hand, but the question is now stuck in my head, is would there be any issue had it been left like this, and what did it think I was trying to do (perhaps something I am unaware of is why it allowed it to happen?)


Essentially it looks like it allows me to define the type as integer, and the default as a string, and was doing me the courtesy of converting my mistake?


Is that correct or is there a situation where such would be preferable, required, or is the question simply moot?





Aucun commentaire:

Enregistrer un commentaire