Re: Setting DEFAULT to empty string using SQL



Have you tried using NULL? Otherwise just create the table with
'UNKNOWN'contained in all of the records for the last column, then
update the table with either NULL or an empty string.

Yes, I decided I didn't want to use NULLs in this case (actually I'm
declaring the fields with NOT NULL). And having a default value that is
something other than an empty string will not make any sense in this case.
Then it's better to not have any default value at all, and make sure to
always specify a value (valid or empty) when inserting rows.

I just thought it would be utterly stupid if it wasn't possible to have
empty strings as default values (I know it's possible to create such
tables using the Access user interface). But then again, it is SQL and SQL
must be the most stupid and inconsistent language ever created.

Best regards
Tomas Eklund



.



Relevant Pages

  • Re: C# Nullable types
    ... applicable" have never been identified with "null" in SQL or anywhere else. ... purpose and meaning and the minute you try to attach a meaning that is ... empty string will do. ... but if we don't know the price, that doesn't make the price null, it ...
    (microsoft.public.dotnet.framework)
  • Re: C# Nullable types
    ... I will just end with how the SQL Server doc explains this. ... meaning of null, which is the point of this thread. ... into the field" which is IMO bad form at least to do systematically. ... use an empty string or 0 as a default value if it makes senses. ...
    (microsoft.public.dotnet.framework)
  • Re: bypassing some of the parameters in a parameter query
    ... The SQL I suggested is pretty much minimal for the job you want to do. ... >> Well, WHERE does work in design view, but having a lot of ANDs and ORs ... then tests to see if it is an empty string. ... >> Microsoft Access MVP ...
    (microsoft.public.access.queries)
  • Re: Read column description with ADO OpenSchema, SQL Server 2000
    ... which returns column descriptions from sysproperties table... ... >> do the same thing and it does if source is Access for example but SQL ... >> returns empty string even though there is a description defined. ... > You can not get value of SQL Server column description field by OpenSchema ...
    (microsoft.public.sqlserver.programming)
  • SQL Wrappers
    ... it was straightforward to code something into the CSV file ... that would result in a NULL being passed to the SQL user. ... Since there was nothing between the commas, ... how do you pass an empty string? ...
    (comp.databases.theory)