Thứ Ba, 28 tháng 6, 2011

Column

Thêm cột:
ALTER TABLE TableName ADD ColumnName INT
VD: ALTER TABLE HocSinh ADD NgaySinh DateTime

Đổi tên cột:
The script for renaming any column :
sp_RENAME 'TableName.[OldColumnName]' , '[NewColumnName]', 'COLUMN'

The script for renaming any object (table, sp etc) :
sp_RENAME '[OldTableName]' , '[NewTableName]'

(http://blog.sqlauthority.com/2008/08/26/sql-server-how-to-rename-a-column-name-or-table-name/)

Thứ Bảy, 25 tháng 6, 2011

jQuery: How to return value from anonymous function

Apparantely jQuery's post function is only asynchronous, so you cannot.
... use the $.ajax function and set the async option to false ...

(http://www.webdeveloper.com/forum/showthread.php?t=215229)

Thứ Tư, 22 tháng 6, 2011

SQL SERVER – Drop Contraint

/* For SQL Server/Oracle/MS ACCESS */
ALTER TABLE Table1
DROP CONSTRAINT PK_Table1_Col1
GO

/* For MySql */
ALTER TABLE Table1
DROP PRIMARY KEY
GO


(http://blog.sqlauthority.com/2009/05/12/sql-server-how-to-drop-primary-key-contraint)

SQL SERVER – Create Default Constraint Over Table Column

ALTER TABLE Customers
ADD CONSTRAINT DF_Customers_Address2
DEFAULT 'UNKNOWN' FOR Address2


(http://blog.sqlauthority.com/2008/05/31/sql-server-create-default-constraint-over-table-column)