DepartmentProject/SqriptsSQL/PrepareForSync.sql
2022-12-16 17:43:23 +04:00

30 lines
465 B
Transact-SQL

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] = 'Ñòóäåíò'
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