- Details
- Written by: po3dno
- Category: MSSQL
- Hits: 750
use [DBNAME]
EXEC sp_rename 'v8users', 'v8users_old'
GO
UPDATE Params
SET FileName = 'users.usr_old'
WHERE FileName = 'users.usr'
GO
use [DBNAME]
DROP TABLE v8users
GO
EXEC sp_rename 'v8users_old', 'v8users'
GO
UPDATE Params
SET FileName = 'users.usr'
WHERE FileName = 'users.usr_old'
GO
- Details
- Written by: po3dno
- Category: MSSQL
- Hits: 811
declare @DbId as int = db_id(N'имя_базы') use [master]; select [now] = cast(sysdatetime() as datetime2(0)) /*, [db_name] = db_name(er.[database_id]) */ , es.session_id , er.[status] , er.command /*, [sql_command] = case when er.sql_handle is null then null else (select [text] from sys.dm_exec_sql_text(er.sql_handle)) end*/ , er.percent_complete , er.[wait_resource] , er.blocking_session_id , es.[program_name] , es.[host_name] , es.[login_name] , es.[nt_user_name] , er.start_time , er.[user_id] , er.connection_id from sys.dm_exec_requests er inner join sys.dm_exec_sessions es on es.[session_id] = er.[session_id] where er.database_id = @DbId ;