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

sqlserver ÉÏ»úÁ·Ï°Ìâ

 create database db
use db
go
create table course
(
 sno varchar(20),
 cno int ,
 Gmark int
)
insert into course values('20071513115',1,80)
insert into course values('20071513114',2,80)
insert into course values('20071513113',3,80)
insert into course values('20071513112',4,80)
insert into course values('20071513111',1,80)
insert into course values('20071513110',2,80)
insert into course values('20071513116',3,80)
insert into course values('20071513117',1,80)
select  distinct cno from course
go
create table student
(sno char(7) not null primary key,
 sname varchar(20) not null,
 ssex char(2) not null,
 sage smalldatetime ,
 spno char(5),
 classid char(5),
 Inyear char(4) not null )
insert into student
values('2000101','ÀîÓÂ','ÄÐ','1980-7-1','00311','10497','1999')
insert into student
values('2000102','ÁõÊ«³¿','Å®','1981-8-12','00311','10498','1999')
insert into student
values('2000103','ÍõÒ»Ãù','ÄÐ','1982-12-20','00312','10497','2001')
insert into student
values('2000104','ÕÅæÃæÃ','Å®','1985-5-9','00312','10498','2000')
insert into student
values('2001101','ÀîÃô','Å®','1989-3-9','01311','10497','1999')
insert into student
values('2001102','¼ÖÏòÄÐ','Å®','1982-9-3','01311','10498','2000')
insert into student
values('2001103','³ÂÀ','ÄÐ','1981-5-7','01311','10497','1999')
insert into student
values('2000105','ÕÅÈý','ÄÐ','1984-6-7','01311','10497','1999')
insert into student
values('2000106','ÕÅ','ÄÐ','1984-6-7','01311','10497','1999')
select * from student where spno='01311' and  ssex='Å®'
go
select sname,ssex,sage from student where spno in('01311','01312')
go
select * from student where  sname like 'Àî%'
go


Ïà¹ØÎĵµ£º

sqlServer ÖÐ »ñÈ¡ºº×Ö×Ö´®µÄÆ´ÒôÉùĸ

 CREATE        function fGetPy(@str varchar(500)='')
returns varchar(500)
as
begin
    declare @strlen int,@return varchar(500),@ii int
    declare @c nchar(1),@chn nchar(1)
    select @strlen=len(@str),@retur ......

WindowsÏÂSQLServerµÄ¼¯ÈºÅäÖÃ

»ù±¾ÅäÖÃ
Ò»¡¢ÎļþϵͳҪÇó£º
1¡¢ÖÁÉÙÓжþ¸ö·ÖÇø£»
2¡¢ÏµÍ³·ÖÇø²»Ð¡ÓÚ10G£»
3¡¢·ÖÇø¸ñʽ±ØÐëÊÇNTFS¡£
¶þ¡¢²¹¶¡°²×°ÒªÇó£º
1¡¢ÏÈ°²×°Íê±ÏWINDOWS 2000 SP4+³å»÷²¨+Õðµ´²¨²¹¶¡£»
2¡¢½«WINDOWS 2000²¹¶¡Éý¼¶µ½×îкó²Å¿É°²×°cluster ºÍSQL Server£»
3¡¢SQL Server²¹¶¡ÐèÉý¼¶µ½Service Pack 3¡£
Èý¡¢ClusterÐÅÏ¢£º
1£ ......

SqlServerÖÐ×Ô¶¨ÒåÀàËÆSplit½ØÈ¡×ֶκ¯Êý

if exists (select * from dbo.sysobjects where name='SplitStr' )
drop FUNCTION SplitStr
go
CREATE   FUNCTION   SplitStr   (@splitString   varchar(8000),   @separate   varchar(10))  
RETURNS   @returnTable   ......

³õʶSQLSERVER´¥·¢Æ÷(Ò»)


´¥·¢Æ÷ÊÇÒ»ÖÖÌØÊâµÄ´æ´¢¹ý³Ì£¬ÀàËÆÓÚÆäËü±à³ÌÓïÑÔÖеÄʼþº¯Êý£¬SQL Server? ÔÊÐíΪ INSERT¡¢UPDATE¡¢DELETE ´´½¨´¥·¢Æ÷£¬µ±ÔÚ±í£¨ÊÓͼ£©ÖвåÈë¡¢¸üС¢É¾³ý¼Ç¼ʱ£¬´¥·¢Ò»¸ö»òһϵÁÐ T-SQL Óï¾ä¡£
    ±¾×¨ÌâµÄÄ¿µÄ²¢·ÇÊÇÏòÄúÏ꾡µØ½éÉÜ´¥·¢Æ÷£¬¶øÊÇϵͳµØÏòÄú½éÉÜ´¥·¢Æ÷µÄ³£ÓÃ֪ʶÓëÏà¹ØÓ¦Ó㬲¢ÓëÄúÒ ......

SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ

¡¾ÎÊÌâÃèÊö£º¡¿
      Ò»¸öÓû§±íÖеÄ×¢²áÈÕÆÚÏÔʾ¸ñʽÊÇ£ºyyyy-mm-dd Thh:mm:ss.mmm ¡£¶øÎÒÏëͳ¼Æ³öÿÌìµÄÓû§×¢²áÊý£¬Ö±½Ógroup×¢²áÈÕÆÚ×Ö¶ÎÏÔÈ»ÊDz»Ðеġ£
¡¾ÎÊÌâ´¦Àí£º¡¿
      ÀûÓÃSQLserverÖеÄconvertº¯Êý¶ÔÈÕÆÚ½øÐÐת»»×ª»»¡£groupת»»ºóµÄÈÕÆÚ¡£
¡¾½Å  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ