sqlserver ÊÓͼ
/*drop table scourse
drop table course
drop table student
drop table major*/
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 )
--¿Î³Ì±í
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))
/*£¨1£©½¨Á¢00312רҵѡÐÞÁË001ºÅ¿Î³ÌµÄѧÉúÊÓͼStu_01312_1£»
£¨2£©½¨Á¢00312רҵѡÐÞÁË1ºÅ¿Î³Ì²¢Çҳɼ¨²»¼°¸ñµÄѧÉúÊÓͼStu_00312_2£»
£¨3£©½¨Á¢ÊÓͼStu_year£¬ÓÉѧÉúѧºÅ¡¢ÐÕÃû¡¢ÄêÁä×é³É£»
£¨4£©Í¨¹ýÊÓͼ²éѯ20ËêÒÔÉϵÄѧÉúÐÕÃû£»
£¨5£©Í¨¹ýÊÓͼ²éѯ00312רҵѡÐÞÁË1ºÅ¿Î³Ì²¢Çҳɼ¨²»¼°¸ñµÄѧÉúµÄѧºÅ¡¢ÐÕÃû¡¢ÄêÁä¡£*/
//µÚÒ»Ìâ
drop view Stu_01312_1
go
create view Stu_01312_1 as select * from student where spno='00312' and sno in (select sno from scourse where cno='1')
go
select * from Stu_01312_1
//µÚ¶þÌâ
drop view Stu_00312_2
go
create view Stu_00312_2 as select * from student where spno='00312' and sno in(select sno from scourse where cno='1' and Gmark < 60)
go
select * from Stu_00312_2
//µÚÈýÌâ
drop view Stu_00312_3
go
create view Stu_00312_3 as select sno,sname,sage from student
go
//µÚËÄÌâ
select sname from Stu_00312_3 where sage >20
//µÚÎåÌâ
select sno,sname,sage from Stu_00312_2
Ïà¹ØÎĵµ£º
ÍÐÁ˼¸ÌìµÄÄÑÌ⣬ÖÕÓÚ½â¾öÁË¡£ÌØ·ÖÏíÒ»ÏÂ
ÒÔÏÂÊÇÒ»¸ö´æ´¢¹ý³Ì
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 ......
ת»»·½·¨£º convert(nvarchar(8),starttime,14)
100 (1, 2)
ĬÈÏÉèÖÃ
mon dd yyyy hh:miAM£¨»ò PM£©
101
&nbs ......
Sql ServerµÄ´æ´¢¹ý³ÌÊÇÒ»¸ö±»ÃüÃûµÄ´æ´¢ÔÚ·þÎñÆ÷ÉϵÄTransacation-SqlÓï¾ä¼¯ºÏ,ÊÇ·â×°Öظ´ÐÔ¹¤×÷µÄÒ»ÖÖ·½·¨,ËüÖ§³ÖÓû§ÉùÃ÷µÄ±äÁ¿¡¢Ìõ¼þÖ´ÐкÍÆäËûÇ¿´óµÄ±à³Ì¹¦ÄÜ¡£
´æ´¢¹ý³ÌÏà¶ÔÓÚÆäËûµÄÊý¾Ý¿â·ÃÎÊ·½·¨ÓÐÒÔϵÄÓŵ㣺
&nbs ......
jdbcÅäÖÃÓï¾äΪ: jdbc:microsoft:sqlserver://server_name:1433
ÈçÔËÐгÌÐòʱ³öÏÖ "Error establishing socket" ´íÎó,ÔòÓ¦½øÐÐÈçϵ÷ÊÔ:
1 ¼ì²éSQL SERVER ÊÇ·ñÔÊÐíÔ¶³Ì·ÃÎÊ.¾ßÌå²½Öè:
1)´ò¿ª"ÆóÒµ¹ÜÀíÆ÷",´ò¿ª¿ØÖÆ̨¸ùĿ¼>SQL Server ×é>Êý¾Ý¿â
2)ÔÚÏàÓ¦"Êý¾Ý¿â"Éϵ¥»÷ÓÒ¼ü,Ñ¡Ôñ"ÊôÐÔ"
3)Ñ¡Ôñ"Á¬½Ó"Ñ ......
import pymssql
#connect database
conn=pymssql.connect(host="192.168.1.28",user="boomink",password="boomink",
database="boomink")
cur=conn.cursor()
print '========================================'
cur.execute("exec Orders_GetTest1 @Valu ......