1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
| USE Student GO CREATE LOGIN test FROM WINDOWS WITH DEFAULT_DATABASE=Student;
CREATE LOGIN sqluser WITH PASSWORD='1234';
EXEC sp_addlogin sqluser,'1234';
USE Student GO CREATE USER u1 FOR LOGIN sqluser;
EXEC sp_adduser sqluser,u1;
EXEC sp_addlogin usersf,'uesrsf'; EXEC sp_addsrvrolemember usersf,sysadmin;
USE xsgl GO EXEC sp_adduser usersf,usersf; EXEC sp_addrole usersf; EXEC sp_addrolemember db_owner,usersf;
CREATE LOGIN u2 WITH PASSWORD ='u2'; CREATE LOGIN u3 WITH PASSWORD ='u3'; USE SPJ GO CREATE USER u2 FOR LOGIN u2; CREATE USER u3 FOR LOGIN u3;
EXEC sp_adduser u2,u2; EXEC sp_adduser u3,u3;
USE SPJ GO GRANT SELECT ON S TO u2 WITH GRANT OPTION ; GRANT UPDATE ON P TO u2 WITH GRANT OPTION;
USE SPJ GO GRANT SELECT ON S TO u3; GRANT UPDATE ON P TO u3;
USE SPJ GO SELECT * FROM S; INSERT INTO S(SNO) VALUES('S0');
USE SPJ GO REVOKE SELECT ON S FROM u3; REVOKE UPDATE ON P FROM u3;
USE Student GO CREATE ROLE operate; GRANT SELECT ON Student TO operate; GRANT SELECT ON Course TO operate;
DENY UPDATE ON SC TO u1;
EXEC sp_addrolemember operate,u1;
UPDATE SC SET Grade=100 WHERE Sno='S1';
USE Student GO GRANT CREATE TABLE TO u1;
CREATE LOGIN weilogin WITH PASSWORD ='weilogin'; CREATE USER wei FOR LOGIN weilogin; GRANT SELECT,INSERT ON jg_test TO wei;
CREATE SCHEMA jg_test AUTHORIZATION u1; USE Student GO CREATE TABLE U1_S ( S1 INT PRIMARY KEY , S2 CHAR(10) );
PRINT '今天的日期是'+CONVERT(VARCHAR(12),GETDATE(),101) PRINT '今年是'+CONVERT(VARCHAR(12),YEAR(GETDATE())) PRINT '本月是'+CONVERT(VARCHAR(12),MONTH(GETDATE()))+'月' PRINT '今天是'+CONVERT(VARCHAR(12),DAY(GETDATE()))+'号' PRINT '后天是'+CONVERT(VARCHAR(12),DATEADD(Dy,2,GETDATE()),102) PRINT '与2019年6月7号还差'+CONVERT(VARCHAR(12),DATEDIFF(DAy,getdate(),'06/07/2019'))+'天' PRINT '现在是星期'+CONVERT(VARCHAR(12),DATEPART(Dw,getdate()))
|