середа, 25 листопада 2009 р.

mysql.servers

Sometimes one can see an error like:

MySQL database failed! : SQL flush privileges failed : Table 'mysql.servers' doesn't exist at...

A guy named Chris Brown suggested the following:

USE mysql;

CREATE TABLE `servers` (
`Server_name` char(64) NOT NULL,
`Host` char(64) NOT NULL,
`Db` char(64) NOT NULL,
`Username` char(64) NOT NULL,
`Password` char(64) NOT NULL,
`Port` int(4) DEFAULT NULL,
`Socket` char(64) DEFAULT NULL,
`Wrapper` char(64) NOT NULL,
`Owner` char(64) NOT NULL,
PRIMARY KEY (`Server_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='MySQL Foreign Servers table';

вівторок, 17 листопада 2009 р.

Ignore duplicates for unique fields

So, you add multiple data rows into table with UNIQUE index on some field but when you add the duplicates into that field the routine is stopped.

How to make the insert skip those values?

Create the index in this way:

CREATE INDEX NotAllowed
ON Dest (Value)
WITH(IGNORE_DUP_KEY = ON);
go

The size of NULL

How much space does NULLs take for different types?

What nullable types allocate space even when null?

http://social.msdn.microsoft.com/Forums/en/sqldatabaseengine/thread/dc168f01-075f-4f29-a669-eba93b4db6a0

Do columns occupy space even if they store NULL?

http://sankarreddy.spaces.live.com/blog/cns!1F1B61765691B5CD!387.entry

Space used for NULL

http://social.msdn.microsoft.com/Forums/en/sqlgetstarted/thread/e6b8abb8-851e-498d-93f0-2701f8e44b22

Null Values

http://msdn.microsoft.com/en-us/library/ms191504.aspx