_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
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

螳襦企 覓危 殊 伎る 蟆 るジ 襦 殊 蠍壱螳 蠍 蟆企.