_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › 襦蠏語//ろる/蟠

Contents

1 襦蠏語
2 ろる
3 覦 蟠覿
4
5 谿瑚


1 襦蠏語 #

--襦蠏語 
USE master;

IF EXISTS (SELECT * FROM sys.server_principals WHERE name = 'yasicom')
	DROP LOGIN yasicom;

CREATE LOGIN yasicom
WITH 
	PASSWORD = 'pw1234!@#$' 
,	DEFAULT_DATABASE = tempdb
,	CHECK_EXPIRATION = OFF
,	CHECK_POLICY = OFF;
GO	

2 ろる #

--ろる 
USE tempdb;

IF EXISTS(SELECT * FROM sys.schemas WHERE name = 'TestSchema')
	DROP SCHEMA PubDiv;
GO

CREATE SCHEMA TestSchema
GO

--alter schema dbo transfer ABC.TableAAA

3 覦 蟠覿 #

-- 
IF EXISTS(select * from sys.database_principals WHERE name = 'yasicom')
	DROP USER yasicom;
GO

CREATE USER yasicom FOR LOGIN yasicom
WITH DEFAULT_SCHEMA = TestSchema;
GO

--蟠覿
GRANT SELECT ON SCHEMA::TestSchema TO yasicom;
GO

/*
DB 蟆曙
EXEC sp_addrolemember 'db_owner', '覈'
GO
*/

4 #

--ろ
CREATE TABLE TestSchema.Test(nm varchar(20));
INSERT TestSchema.Test VALUES('Hello World!');

--覲蟆:yasicom
EXECUTE AS USER = 'yasicom';
SELECT USER_NAME(); --yasicom

SELECT * FROM TestSchema.Test

--覲蟆:dbo
REVERT
SELECT USER_NAME(); --dbo

5 谿瑚 #

覓語..
ALTER AUTHORIZATION ON Database::XXXX TO sa;
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

語 譯朱覦 碁朱れ 炎概蠍 覦 レ覓殊 覿豎れ 螳 讀覈 譴. 蠏碁れ 蟇磯 ろ 蠍磯ゼ 讌 蠍 覓語 豪Μ螳 . (B.C 觚)