Friday, June 27, 2008

SQL Server: how to prohibit empty strings globally?

We'd like to prohibit empty strings by SQL Server means (not
programmatically on C# level); only NULLs (for nullable fields) should
be allowed.

We can use

ALTER TABLE TableName ADD CONSTRAINT ck_FieldName CHECK ((FieldName <> '') OR (FieldName IS NULL))

But how to do it globally on the level of a database (or SQL Server
instance), so that it wouldn't be necessary to remember to add the
above constraint to each and every table?

(We are using SQL Server 2008.)

.NET 3.5 SP1 breaks SQL Server 2008 (CTP5 Management Studio SQL)

I installed .NET 3.5 SP1 and Visual Studio 2008 SP1 beta just to find out that my SQL Server 2008 ((CTP5 Management Studio SQL)) doesn't work any more. Instead it displays "The Tabular Data Stream (TDS) version 0x730b0003 of the client library used to open the connection is unsupported or unknown. The connection has been closed." error message when I try to connect to a SQL Server. Searching on Google didn't help much.