T-SQL quries

SELECT @@VERSION;

SELECT SERVERPROPERTY('EngineEdition');

1 = Personal or Desktop Engine
2 = Standard
3 = Enterprise
4 = Express
5 = SQL Database
6 = SQL Data Warehouse
8 = SQL Managed Instance

SELECT * FROM sys.databases;
SELECT * FROM sys.objects;

SELECT * FROM sys.dm_os_schedulers where STATUS = 'VISIBLE ONLINE';

SELECT * FROM sys.dm_process_memory

Azure SQL:SELECT * FROM sys.dm_user_db_resource_governance;SELECT * FROM sys.dm_os_job_object

SELECT * FROM sys.dm_exec_requests;

 

CREATE LOGIN ApplicationUser WITH PASSWORD = 'YourStrongPassword1';

-- Create a new SQL user from that login
CREATE USER ApplicationUser FOR LOGIN ApplicationUser;

-- Until you run the following two lines, ApplicationUser has no access to read or write data
ALTER ROLE db_datareader ADD MEMBER ApplicationUser;
ALTER ROLE db_datawriter ADD MEMBER ApplicationUser;
ALTER TABLE Data.Membership ALTER COLUMN FirstName
ADD MASKED WITH (FUNCTION = 'partial(1, "xxxxx", 1)')
GRANT UNMASK TO DataOfficers;
REVOKE UNMASK TO Bob;  
EXECUTE AS USER = 'Bob';

 SELECT DATABASEPROPERTYEX(DB_NAME(), 'Updateability')

SELECT client_net_address FROM sys.dm_exec_connections WHERE session_id=@@SPID;

DBCC SHRINKDATABASE

DBCC SHRINKFILE

 

 

posted on 2021-08-12 17:30  格物致知2019  阅读(31)  评论(0编辑  收藏  举报

导航