неділя, 30 серпня 2009 р.

Auto-increment field

How to create it in

a) MySQL:

CREATE TABLE `t1` ( `id` INT UNSIGNED AUTO_INCREMENT , ... ) AUTO_INCREMENT=... ;

b) PostgreSQL:
first create the sequence:

CREATE SEQUENCE "seq1" INCREMENT BY ... START WITH ... ;

and then - create the table:

CREATE TABLE "t1" ( "id" INT NOT NULL DEFAULT nextval('seq1') ...);

c) Microsoft SQL Server

CREATE TABLE [t1] ( [id] [int] NOT NULL identity(1, 2) ...);

(this means start with 1 and increment by 2 each time )

Paint & SQL Server. How to export diagram to image.

I think many people wondered why Paint application still exists in Windows? It has too few features. It is completely basic (or boring!).

But this tool can greatly help you with database design.

Say, you have the database diagram built in MSSQL Management Studio but you have no idea how to export it into the image.

Just PAINT !!!

Select all of the tables in the diagram, press Ctrl+C (or copy in your usual way) and paste it into Paint.

Do you like it?

понеділок, 3 серпня 2009 р.

Ukrainian, Russian and English character sets for Sphinx fulltext search

If you need all of those language for fulltext search the charset_table string should be the following:

charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F, U+404->U+454, U+406->U+456, U+407->U+457, U+490->U+491