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

sqlserver ÆÚÖп¼ÊÔÌâ

 create database DB
use DB
--רҵ±í
create table major
(spno char(5) not null primary key,
 spname varchar(20) not null,
 pno char(2) )
--ѧÉú±í
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) not null foreign key references major(spno),
 classid char(5),
 Inyear char(4) not null )
select datediff(yyyy,'1981-8-12',getdate())from student
--¿Î³Ì±í
create table course
(cno char(10) not null primary key,
cname varchar(20) not null,
credit smallint ,
tno char(3))
--Ñ¡¿Î±í
create table scourse
(sno char(7) not null foreign key references student(sno),
 cno char(10) not null foreign key references course(cno),
 Gmark numeric(4,1),
primary key(sno,cno))
//µÚÒ»Ìâ
select * from student where datediff(yyyy,sage,getdate()) between 25 and (select datediff(yyyy,sage,getdate()) from student  where sname='ÀîÓÂ')
//µÚ¶þÌâ
select sno,sname from student where sno in  (  select sno from scourse where cno=(select cno from course where cname='²Ù×÷ϵͳ'))
//µÚÈýÌâ
 
select sname from student where sno in (select distinct sno from scourse where cno not in('1'))
//µÚËÄÌâ
select sname,sno  from student where sno in(select sno from scourse group by sno having count(sno)=(select count(*) from course))
select student.sname,student.sno  from student where student.sno in(select scourse.sno from scourse group by scourse.sno having count(scourse.sno)=(select count(*) from course))
//µÚÎåÌâ
select sname from student where sno in (select sno from student where Inyear='1999') and sno in (select sno from scourse where Gmark is null) and spno in(select spno from major where spname='¼ÆËã»úÈí¼þ')
select student.sname from student where  student.sno in (select student.sno from student where student.Inyear='1999')   and student.sno in (select scourse.sno from scourse where


Ïà¹ØÎĵµ£º

SQLServerµ¼³ö±íµ½EXCELÎļþµÄ´æ´¢¹ý³Ì

 SQL Serverµ¼³ö±íµ½EXCELÎļþµÄ´æ´¢¹ý³Ì:
¡¡¡¡*--Êý¾Ýµ¼³öEXCEL
¡¡¡¡µ¼³ö±íÖеÄÊý¾Ýµ½Excel,°üº¬×Ö¶ÎÃû,ÎļþΪÕæÕýµÄExcelÎļþ
¡¡¡¡,Èç¹ûÎļþ²»´æÔÚ,½«×Ô¶¯´´½¨Îļþ
¡¡¡¡,Èç¹û±í²»´æÔÚ,½«×Ô¶¯´´½¨±í
¡¡¡¡»ùÓÚͨÓÃÐÔ¿¼ÂÇ,½öÖ§³Öµ¼³ö±ê×¼Êý¾ÝÀàÐÍ
¡¡¡¡---*/
¡¡¡¡/**//*--µ÷ÓÃʾÀý
¡¡¡¡p_exporttb @tbname='µØÇø ......

JAVA SQLSERVERÊý¾Ý¿âÁ¬½Ó

 package cn.ctgu.edu.ac;
import java.sql.*;
public class test {
 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  String url="jdbc:sqlserver://localhost:1433;Database=ÍøÉÏÊéµê¹ÜÀíϵͳ;integr ......

ʹÓÃSqlserverÊÂÎñ·¢²¼ÊµÏÖÊý¾Ýͬ²½

      ÊÂÎñµÄ¹¦ÄÜÔÚsqlserverÖÐÓÉÀ´ÒѾã¬ÒòΪ×î½üÔÚ×öÒ»¸öÊý¾Ýͬ²½·½°¸£¬ËùÒÔÓлú»áÔÙ´ÎÑо¿Ò»ÏÂËüÒÔ¼°¿ìÕյȣ¬·¢ÏÖ»¹ÊÇÓкܶ಻´íµÄ¹¦Äܺ͸ĽøµÄ¡£ÕâÀïÒÔsqlserver2008µÄÊÂÎñ·¢²¼¹¦ÄÜΪÀý£¬¶Ô·¢²¼¶©Ôĵķ½Ê½¼òÒª½éÉÜһϲÙ×÷Á÷³Ì£¬Ò»·½Ãæ×ö¸ö×ܽᱸ·Ý£¬Ò»·½ÃæÓë´ó¼Ò½øÐÐһϷÖÏíºÍ½»Á÷¡£·Ñ»°¾Í² ......

SQLServer 2008¿çÊý¾Ý¿âʵÀýÊÂÎñ´¦Àí

 ÍÐÁ˼¸ÌìµÄÄÑÌ⣬ÖÕÓÚ½â¾öÁË¡£ÌØ·ÖÏíÒ»ÏÂ
ÒÔÏÂÊÇÒ»¸ö´æ´¢¹ý³Ì
CREATE PROCEDURE deleteAccountAll
 @id int
AS
SET XACT_abort ON
BEGIN DISTRIBUTED TRAN
delete from AccountCapital where accountid = @id
delete from logininfo where username = @id
delete from CapitalRecord where accountid ......

SQLServerÈÕÆÚ¸ñʽ´úÂë

ת»»·½·¨£º convert(nvarchar(8),starttime,14)
    100   (1,   2)  
    ĬÈÏÉèÖà  
    mon   dd   yyyy   hh:miAM£¨»ò   PM£©     
    
    101  
&nbs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ