1
0
mirror of https://github.com/akpaevj/executor-scripts.git synced 2024-11-28 09:33:50 +02:00
This commit is contained in:
akpaevj 2024-03-05 16:38:02 +03:00
parent 584768e363
commit f1b69e62ac

View File

@ -138,7 +138,7 @@ method SetSingleUserMode(Connection: SqlConnection, DatabaseName: String)
val Query = Connection.CreateQueryWithoutSelect( val Query = Connection.CreateQueryWithoutSelect(
"IF EXISTS (SELECT 1 FROM sys.databases WHERE [name] = N'%DatabaseName') "IF EXISTS (SELECT 1 FROM sys.databases WHERE [name] = N'%DatabaseName')
BEGIN BEGIN
EXEC (N'ALTER DATABASE %DatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE;'); EXEC (N'ALTER DATABASE [%DatabaseName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;');
END;") END;")
Query.Execute() Query.Execute()
@ -148,7 +148,7 @@ method SetMultiUserMode(Connection: SqlConnection, DatabaseName: String)
val Query = Connection.CreateQueryWithoutSelect( val Query = Connection.CreateQueryWithoutSelect(
"IF EXISTS (SELECT 1 FROM sys.databases WHERE [name] = N'%DatabaseName') "IF EXISTS (SELECT 1 FROM sys.databases WHERE [name] = N'%DatabaseName')
BEGIN BEGIN
EXEC (N'ALTER DATABASE %DatabaseName SET MULTI_USER;'); EXEC (N'ALTER DATABASE [%DatabaseName] SET MULTI_USER;');
END;") END;")
Query.Execute() Query.Execute()