close

[會陸續更新]

與使用者/帳號有關的 :

l   Create Login

CREATE LOGIN testLogin WITH password='!QAZ2wsx'

l   Create User

CREATEUSER testUser FROM LOGIN testLogin

l   Alert Login (ex: 用來修改登入密碼)

ALTER LOGIN testLogin WITH password='@WSX3edc'

l   Permissions (ex: 將使用者加到datareader群組)

EXEC sp_addrolemember 'db_datareader', 'testUser'

 

資料庫相關

l   複製Database

CREATE DATABASE AdventureWorks2 AS COPY OFAdventureWorks

l   Index Fragmentation

SELECTo.name AS ObjectName,

   i.name AS IndexName,

   ddips.avg_fragmentation_in_percent,

   ddips.page_count,

   ddips.compressed_page_count,

   ddips.index_depth,

   ddips.record_count

FROMsys.dm_db_index_physical_stats(DB_ID('MovieManagement'),

 

OBJECT_ID('dbo.MovieStage'), DEFAULT, DEFAULT, 'DETAILED') AS ddips

   JOIN sys.objects AS o  

   ON ddips.object_id = o.object_id

   JOIN sys.indexes AS i

   ON ddips.index_id = i.index_id

      AND ddips.object_id = i.object_id;

l   Rebuild Index

ALTER INDEX AgentPK ONdbo.Agent REBUILD;

 

 

arrow
arrow
    文章標籤
    Azure SQL Database T-SQL
    全站熱搜
    創作者介紹
    創作者 my007FFF 的頭像
    my007FFF

    #007FFF

    my007FFF 發表在 痞客邦 留言(0) 人氣()