sql ÐÞ¸ÄÁÐÃû¼°±íÃû
´úÂëÈçÏ£º
EXEC sp_rename '±íÃû.[ÔÁÐÃû]', 'ÐÂÁÐÃû', 'column'
*************************************************************************
Transact-SQL ²Î¿¼
sp_rename
¸ü¸Äµ±Ç°Êý¾Ý¿âÖÐÓû§´´½¨¶ÔÏó£¨Èç±í¡¢ÁлòÓû§¶¨ÒåÊý¾ÝÀàÐÍ£©µÄÃû³Æ¡£
ʾÀý
A. ÖØÃüÃû±í
ÏÂÀý½«±í customers ÖØÃüÃûΪ custs¡£
EXEC sp_rename 'customers', 'custs'
B. ÖØÃüÃûÁÐ
ÏÂÀý½«±í customers ÖеÄÁÐ contact title ÖØÃüÃûΪ title¡£
EXEC sp_rename 'customers.[contact title]', 'title', 'COLUMN'
***********
¶øÐÞ¸ÄÊý¾Ý¿âÃûÔòÓÃ
sp_renamedb [ @dbname = ] 'old_name' , [ @newname = ] 'new_name'
Ïà¹ØÎĵµ£º
constraint Example:
1. grammer:
create table [schema.]table
(column datatype [DEFAULT expr]
[column_constraint], ...
[table_constraint] [,......]);
2. example of a column_level constraint:
create table empl ......
Differring Constraints:
Constraints can have the following attributes: DEFFERRABLE / NOT DEFFERRABLE, INITIALLY DEFFERRED / INITIALLY IMMEDIATE.
e.g.:
alter table dept2 add constraint dept2_id_pk primary key (department_id) deferrable initially deferred; // deferring constraint on creation. ......
(×¢:outerµÄÒâ˼¾ÍÊÇ"ûÓйØÁªÉϵÄÐÐ"¡£)
1.cross join È«ÍâÁ¬½Ó(µÑ¿¨¶û³Ë»ý)
SELECT A.*, B.* from A FULL OUTER JOIN B ON A.ID = B.ID
2.inner join ÄÚÁ¬½Ó(Ôڵѿ¨¶û³Ë»ýµÄ½á¹û¼¯ÖÐÈ¥µô²»·ûºÏÁ¬½ÓÌõ¼þµÄÐÐ)
SELECT A.* from A INNER JOIN B ON A.ID=B.ID
3.left outer join ×óÍâÁ¬½Ó(ÔÚinner joinµÄ½á¹ ......
--> Title : SQL ServerϵͳÊÓͼ
--> Author : wufeng4552
--> Date : 2009-10-28
Ŀ¼ÊÓͼ
Ŀ¼ÊÓͼ·µ»Ø SQL Server Êý¾Ý¿âÒýÇæÊ¹ÓõÄÐÅÏ¢¡£½¨ÒéÄúʹÓÃĿ¼ÊÓͼÕâÒ»×î³£ÓõÄĿ¼ԪÊý¾Ý½çÃæ£¬Ëü¿ÉΪÄúÌṩ×îÓÐЧµÄ·½·¨À´»ñÈ¡¡¢×ª»»²¢ÏÔʾ´ËÐÅÏ¢µÄ×Ô¶¨ÒåÐÎʽ¡£ËùÓÐÓû§¿ÉÓÃĿ¼Ԫ ......
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace DAL
{
......