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

sql ¶à±í¹ØÁª²éѯ

 create database example
use example
create table major
(
 spno varchar(10) primary key not null,
 spname varchar(20) not null
 )
 create table student
(
 sno varchar(10) primary key not null,
 sname varchar(10) not null,
 ssex varchar(2) not null,
 spno varchar(10) foreign key references major(spno)
)
create table course
( cno varchar(10) primary key not null,
  cname varchar(10) not null
 )
create table  scourse
(
 sno varchar(10) foreign key references student(sno),
 cno varchar(10) foreign key references course(cno),
 gmark int
)
insert into major values('001','Ó¢Óï')
insert into major values('002','ÓïÎÄ')
insert into major values('003','Êýѧ')
insert into major values('004','ÉúÎï')
insert into major values('005','ÎïÀí')
insert into major values('006','»¯Ñ§')
insert into student values('2007151301','bobo','ÄÐ','001')
insert into student values('2007151302','roy','ÄÐ','002')
insert into student values('2007151303','max','ÄÐ','004')
insert into student values('2007151304','tony','ÄÐ','004')
insert into student values('2007151305','jaims','ÄÐ','005')
insert into student values('2007151306','wing','ÄÐ','006')
insert into student values('2007151307','allen','ÄÐ','001')
insert into student values('2007151308','heng','ÄÐ','002')
insert into student values('2007151309','chart','ÄÐ','003')
insert into course values('001','ƹÅÒÇò')
insert into course values('002','ÀºÇò')
insert into course values('003','×ãÇò')
insert into course values('004','ÍøÇòÇò')
insert into course values('005','Î赸')
insert into course values('006','è¤Ù¤')
insert into course values('007','ÓÎÓ¾')
insert into scourse values('2007151301','001','88')
insert into scourse values('2007151302','002','88')
insert into scourse values('2007151303','003','88')
insert into scourse values('2007151304','004','88')
insert into scourse values('2007151305','005','88')
insert into scourse val


Ïà¹ØÎĵµ£º

SQLÊÂÎñ´¦ÀíÓï¾ä×ܽá

 
´æ´¢¹ý³ÌÖг£Óõ½µÄSQLÊÂÎñ´¦ÀíÓï¾ä¸ñʽ¿ÉÄÜ»áÓÐÈçϼ¸ÖÖ:
µÚÒ»ÖÖ:
set   xact_abort   on 
begin   tran 
        insert   ... 
        update   ... 
    ......

SQLµÄÇ°ÊÀ½ñÉú

 Ç°ÑÔÀÎÒ̸µ½ÁËһЩFORTRAN³ÌÐòÔ±ºÍÒ»ÃûLISP³ÌÐòÔ±µÄÊ£¬Ç°ÕßÖ»»áʹÓÃÑ­»·À´½â¾öÎÊÌ⣬ºóÕßÖ»»áʹÓõݹ鷽ʽ½â¾öÎÊÌâ¡£ÕâÖÖÇé¿ö²¢²»
ÉÙ¼û£¬ÒòΪÈËÃǶ¼Ï²»¶Ê¹ÓÃ×Ô¼ºÁ˽âµÄ¹¤¾ß¡£ÏÂÃæ½²Ò»¸öЦ»°£¬²»ÊÇÕæÊ£ºÓÐÈ˸øÒ»¸öÊýѧ¼Ò¡¢Ò»¸öÎïÀíѧ¼ÒºÍÒ»¸öÊý¾Ý¿â³ÌÐòÔ±¸÷·¢ÁËÒ»¸öÏðƤÇò£¬²¢ÇÒÈÃËûÃÇÈ·
¶¨ÇòµÄÌå»ý¡£
Êýѧ¼Ò ......

SQL SERVERÒìµØ±¸·Ý·½·¨(1)

д³É´æ´¢¹ý³Ì£¬½¨Á¢×÷Òµ¶¨Ê±±¸·Ý~~~
--ÔÚsqlÖÐÓ³ÉäһϾͿÉÒÔÁË
exec master..xp_cmdshell 'net use z: \\yizhi\D$ "ÃÜÂë" /user:yizhi\administrator'
/*--˵Ã÷:
exec master..xp_cmdshell 'net use z: \\xz\c$ "ÃÜÂë" /user:xz\administrator'
z:ÊÇÓ³ÉäÍøÂç·¾¶¶ÔÓ¦±¾»úµÄÅÌ·û,ÓëÏÂÃæµÄ±¸·Ý¶ÔÓ¦
\\xz\c$ÊÇÒªÓ³ÉäµÄÍ ......

SQL SERVERÒìµØ±¸·Ý·½·¨(2)

 
/*Á½ÖÖ·½·¨µÄÇ°Ì᣺1.±¾µØ·þÎñÆ÷µÄsqlserver agent·þÎñ±£Ö¤´¦ÓÚÆô¶¯×´Ì¬
   2.Ô¶³Ì¼ÆËã»ú£¨¼ÆËã»ú¹ÜÀíÀ½¨Á¢Ò»¸öÆÕͨȨÏÞÓû§£¬²¢ÎªÆä¼ÓÉÏÃÜÂ루ÀýÈçÓû§ÃûΪkyle£¬ÃÜÂëΪ1234£©£¬Í¬Ê±ÔÚÄÇ̨»úÆ÷µÄ·ÇϵͳÅÌÀィһ¸öÃûΪbackupµÄ¹²ÏíÎļþ¼Ð£¬ÎªÁË°²È«ÁíÍâÉèÖÃÕ ......

sql ²Ù×÷

 exec   sp_rename   't_2.lname','lastname','column' 
exec   sp_rename   ‘tabelname’,'new'
 
»ñµÃsqlÓï¾äµÄÖ´ÐÐʱ¼ä£º
SET STATISTICS TIME ON
// sql Óï¾ä£ºselect * from table
SET STATISTICS TIME OFF
 
 
´´½¨Ë÷Òý£ºCRE ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ