Files
DP44/DataPRO/Modules/Database/DatabaseMigrationScripts/.svn/pristine/e5/e5b889d0f23e6c4a9590493d0d88f860be54adbd.svn-base
2026-04-17 14:55:32 -04:00

28 lines
987 B
Plaintext

DECLARE @UserId INT
DECLARE @PropertyId INT
DECLARE @PropertyValue [NVARCHAR] (MAX)
SELECT @UserId = ID FROM Users WHERE UserName = 'TSRAIRUser'
IF (@UserId IS NOT NULL)
BEGIN
SELECT @PropertyId = PropertyId FROM [dbo].[DefaultProperties] WHERE PropertyName = 'ExportCSVUnfiltered'
IF (@PropertyId IS NULL)
BEGIN
INSERT INTO [dbo].[DefaultProperties] (PropertyName, DefaultValue) VALUES ('ExportCSVUnfiltered', 'False')
SELECT @PropertyId = PropertyId FROM [dbo].[DefaultProperties] WHERE PropertyName = 'ExportCSVUnfiltered'
END
IF (@PropertyId IS NOT NULL)
BEGIN
SELECT @PropertyValue = PropertyValue FROM [dbo].[UserProperties] WHERE UserId = @UserId AND PropertyId = @PropertyId
IF (@PropertyValue IS NULL)
BEGIN
INSERT INTO [dbo].[UserProperties] VALUES (@UserId, @PropertyId, 'True')
END
ELSE
BEGIN
UPDATE [dbo].[UserProperties] SET PropertyValue = 'True' WHERE UserId = @UserId AND PropertyId = @PropertyId;
END
END
END