Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
https://cursor.run

Rahul Sharma RahulSharma

💭
https://cursor.run
View GitHub Profile
View C# FTPLibrary
using System;
using System.IO;
using System.Net;
using System.Text;
namespace FTPLibrary
{
//DTO to hold required info for FTP call
public class ServiceInfo
{
View sql-change-tracking
ALTER DATABASE [your database name] SET CHANGE_TRACKING = ON (CHANGE_RETENTION = 6 DAYS, AUTO_CLEANUP = ON);
View d365-add-db-users.sql
CREATE USER axdeployuser FROM LOGIN axdeployuser
EXEC sp_addrolemember 'db_owner', 'axdeployuser'
CREATE USER axdbadmin FROM LOGIN axdbadmin
EXEC sp_addrolemember 'db_owner', 'axdbadmin'
CREATE USER axmrruntimeuser FROM LOGIN axmrruntimeuser
EXEC sp_addrolemember 'db_datareader', 'axmrruntimeuser'
EXEC sp_addrolemember 'db_datawriter', 'axmrruntimeuser'
View SqlPackage-import
SqlPackage.exe /a:import /sf:D:\Exportedbacpac\my.bacpac /tsn:localhost /tdn:AxDB_fromUAT /p:CommandTimeout=1200
View SqlPackage-export
cd C:\Program Files (x86)\Microsoft SQL Server\140\DAC\bin\
SqlPackage.exe /a:export /ssn:localhost /sdn:<database to export> /tf:D:\Exportedbacpac\my.bacpac /p:CommandTimeout=1200 /p:VerifyFullTextDocumentTypesSupported=false
View d365-delete-db-users.sql
update sysglobalconfiguration
set value = 'SQLAZURE'
where name = 'BACKENDDB'
update sysglobalconfiguration
set value = 1
where name = 'TEMPTABLEINAXDB'
drop procedure if exists XU_DisableEnableNonClusteredIndexes
drop procedure if exists SP_ConfigureTablesForChangeTracking
@RahulSharma
RahulSharma / db-copy.sql
Created May 27, 2020
Create a copy of sql db
View db-copy.sql
BACKUP DATABASE [AxDB] TO DISK = N'D:\Backups\axdb_golden.bak' WITH NOFORMAT, NOINIT, NAME = N'AxDB_golden-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, COMPRESSION, STATS = 10
GO
RESTORE DATABASE [AxDB_CopyForExport] FROM DISK = N'D:\Backups\axdb_golden.bak' WITH FILE = 1,
MOVE N'AXDBBuild_Data' TO N'F:\MSSQL_DATA\AxDB_CopyForExport.mdf',
MOVE N'AXDBBuild_Log' TO N'G:\MSSQL_LOGS\AxDB_CopyForExport_Log.ldf',
NOUNLOAD, STATS = 5
You can’t perform that action at this time.