Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

sqlÓï¾äѧϰ±Ê¼Ç(8) Ìí¼ÓÔ¼Êø£¬ÊµÏÖÊý¾ÝÍêÕûÐÔ

USE StudentInfo
--=====================================================
--Author     £ºyangjuncheng  
--Create Date:2010.5.26
--Decription :¸ø±íÌí¼ÓÔ¼Êø£¨¿ÉÒÔÔÚ´´½¨±íʾֱ½ÓÌí¼Ó
--            Ò²¿ÉÒÔʹÓÃalter¹Ø¼ü×Ö¸øÒÑ´æÔڵıíÌí¼ÓÔ¼Êø
--=====================================================
--=====================================================
--±í½á¹¹ËµÃ÷
--tb_student(stu_id,stu_name,class_id,school_id,stu_address,stu_head,stu_age)
--ÆäÖÐstu_headΪvarbinaryÀàÐÍ£¬´æ·ÅѧÉúµÄµç×ÓÕÕƬ
--tb_school(schoo_id,school_name)
--tb_class(class_id,class_name)
--=====================================================
--checkÔ¼Êø£ºÏÞÖÆѧÉúµÄÄêÁä±ØÐëÔÚ0-100Ö®¼ä
ALTER TABLE tb_student
ADD constraint CK_stu_age CHECK(stu_age>0 AND stu_age<100)
--Ö÷¼üÔ¼Êø£º¸øѧÉú±íÌí¼ÓÒ»¸öÖ÷¼üÔ¼Êø
ALTER TABLE tb_student
ADD CONSTRAINT PK_stu_id PRIMARY KEY (stu_id)
--Íâ¼üÔ¼Êø£ºÑ§Éú±íµÄ°à¼¶idÒýÓð༶±íÖеÄid
ALTER TABLE tb_student
ADD CONSTRAINT FK_class_id FOREIGN KEY (class_id) REFERENCES tb_class(class_id)
--Ìí¼ÓĬÈÏÔ¼Êø£ºÑ§ÉúĬÈϵØַΪ‘Öйú’
ALTER TABLE tb_student
ADD CONSTRAINT DF_stu_address DEFAULT('Öйú') for stu_address
--Ìí¼ÓΨһԼÊø£ºÖ¸¶¨Ñ§ÉúÃûΨһÐÔ
ALTER TABLE tb_student
ADD CONSTRAINT UQ_stu_name UNIQUE(stu_name)


Ïà¹ØÎĵµ£º

ͨ¹ýÅú´¦Àí£¬ÊµÏÖSQL ServerÊý¾Ý¿â¶¨ÆÚ±¸·Ýµ½ftp

@echo off
rem --------------------- ÅäÖÃ: ftpÉÏ´«²ÎÊý,¼°±¾µØÎļþĿ¼(Êý¾Ý¿â±¸·ÝµÄÁÙʱĿ¼)-----------------
set "PUT_FTP_SERVER=192.168.1.100"
set "PUT_FTP_PORT=21"
set "PUT_FTP_USERNAME=ftpuser"
set "PUT_FTP_PASSWORD=ftppasswd"
set "PUT_DIR=/"
set "LOCAL_DIR=D:\sql_dbbackup\"
rem ---------- ......

SQL Default Ô¼ÊøµÄ³õ²½ÈÏʶºÍÀí½â£¡

SQL Default Ô¼ÊøµÄ³õ²½ÈÏʶºÍÀí½â£¡
Ê×ÏÈ´´½¨Ò»Õűíhello
CREATE TABLE hello
(
Id_P int PRIMARY KEY,
Firstname varchar(50),
Lastname varchar(50),
Address varchar(50),
City varchar(50)
)
´´½¨Ô¼ÊøÌõ¼þ
CREATE DEFAULT beijing_const AS 'beijing'
°ó¶¨Ô¼ÊøÌõ¼þµ½ÁÐÉÏ
 sp_bindefault beijing_ ......

sql ¿ç·þÎñÆ÷ ²éѯ

--´´½¨Á´½Ó·þÎñÆ÷
exec sp_addlinkedserver   'ITSV ', ' ', 'SQLOLEDB ', 'Ô¶³Ì·þÎñÆ÷Ãû»òipµØÖ· '
exec sp_addlinkedsrvlogin 'ITSV ', 'false ',null, 'Óû§Ãû ', 'ÃÜÂë '
--²éѯʾÀý
select * from ITSV.Êý¾Ý¿âÃû.dbo.±íÃû
--µ¼ÈëʾÀý
select * into ±í from ITSV.Êý¾Ý¿âÃû.dbo.±íÃû
--ÒÔºó²»Ô ......

sql ×óÁ¬½Ó ½âÊÍ

Á¬½Ó²éѯ£¬¾ÍÊǽ«
Á½¸ö»ò¶à¸ö
±í»òÊÓͼ
ͨ¹ýÒ»¶¨µÄÌõ¼þ
½«È«²¿»ò²¿·Ý×Ö¶Î
È«²¿»ò²¿·Ý¼Ç¼
Á¬½Óµ½Ò»Æ𣬵õ½Ò»¸öеÄÊý¾Ý¼¯ºÏ¡£
È磺ÓÐÈËÔ±µµ°¸ºÍ¹¤×ʵµ°¸Á½¸ö±í£¬Á½¸ö±íÓй²Í¬µÄ¹Ø¼ü×Ö¶ÎXMDM(ÐÕÃû´úÂ룩£¬ÆäÖÐÈËÔ±µµ°¸´æ´¢ÁËÈËÊÂ×ÊÁÏ£¬¹¤×ʵµ°¸´æ´¢ÁËн³ê×ÊÁÏ¡£
Òò´Ë¿ÉÒÔͨ¹ýXMDM×ֶν«Á½¸ö±íÁ¬½ÓÆðÀ´£¬´Ó¶øʹ²éѯ½ ......

SQL Server 2005´æ´¢¹ý³Ì¿ª·¢µÄÒ»µã¾­Ñé

1¡¢  ´æ´¢¹ý³Ì
1£©  ¾¡Á¿½«´úÂë¶Î·Åµ½TRY…CATCH…¡£
µ«·²Ê¹ÓÃC#д¹ý´úÂëµÄÈË£¬¶¼ÖªµÀC#ÖÐTRY…CATCH…µÄÔËÐкͳö´íÌøתÂß¼­£¬¶øSQL Server2005ÖУ¬ÆäÔËÐкͳö´íÌøתÂß¼­ÓëÔÚC#ÖÐÊÇÒ»Öµġ£TRY…CATCH…ÊÇSQL Server2005ÖÐÐÂÔöµÄ£¬¹¦ÄÜÇ¿´ó£¬ÇҺܺÃÓá£
2£©&nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ