Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Default varchar field to empty string on table

Author  Topic 

CoffeeAddict
Yak Posting Veteran

94 Posts

Posted - 2009-03-18 : 10:20:54
I went into SQL Server and changed my DB table to design mode and tried to add a default value by typing in ' ' . WHen I save and close the table, and look at some of the records that previously had NULL for that field, it's not being filled in with the default ''. How can I get an empty string defaulting for all fields (new or existing that have null) on a sql table?

When I go back into the table design mode, I now see this as the default: (' ')

CoffeeAddict
Yak Posting Veteran

94 Posts

Posted - 2009-03-18 : 10:42:49
nevermind, for existing nulls, you have to convert the data to empty string. Then any new records work fine and default automatically to empty string. I was getting an error because some had existing nulls prior to adding that default value in the table definition.
Go to Top of Page
   

- Advertisement -