mirror of
https://github.com/akpaevj/executor-scripts.git
synced 2024-11-28 09:33:50 +02:00
s
This commit is contained in:
parent
584768e363
commit
f1b69e62ac
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user