DepartmentProject/SqriptsSQL/PrepareForSync.sql

30 lines
465 B
MySQL
Raw Permalink Normal View History

2022-12-16 17:43:23 +04:00
USE [DepartmentDatabasePortal]
GO
DELETE FROM [dbo].[OrderSyncHistories]
GO
DELETE FROM [dbo].[Orders]
GO
DELETE FROM [dbo].[Students]
GO
DELETE FROM [dbo].[StudentGroups]
GO
DECLARE @RoleId uniqueidentifier
SELECT @RoleId = [Id]
FROM [dbo].[Roles]
WHERE [RoleName] = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
DELETE u FROM [dbo].[Users] u
JOIN [dbo].[UserRoles] ur ON u.[Id] = ur.[UserId]
WHERE ur.[RoleId] = @RoleId
DELETE FROM [dbo].[UserRoles]
WHERE [RoleId] = @RoleId
GO