View Categories

Database Enabling

2 min read

ss_EnableDatabase.sql #

Provided alongside the SQLSalesInstaller.exe, the “enabling” script ss_EnableDatabase.sql will fully deploy the required SQL Server components (stored procedures and functions).

ss_EnableDatabase.sql is installed to the exe install location – typically to the default C:\Program Files\SQLSales, hence: C:\Program Files\SQLSales\ss_EnableDatabase.sql

Open and compile to your chosen database, to “enable” that database for use with SQL Sales.

Note, SQL-Sales requires that xp_cmdshell is enabled on your SQL Server. If it is not, the enabling script will identify that and provide a suggested script to run, to alter your system configuration settings.

The following are deployed to your target (schema) and database by running the enabling script:

ObjectTypePurpose
ss_AdminStored ProcedurePrimarily to control the Daemon from your SSMS client
ss_DeltaStored ProcedureDelta Replication of Salesforce data
ss_DeltaAllStored ProcedureDelta Replication of Salesforce data (all objects)
ss_HandlerStored ProcedureGeneric process used by most stored procedure calls to interact with the Handler application
ss_LoaderStored ProcedureAllows bulk loads to Salesforce via the SOAP and Bulk APIs (Version 1 & 2)
ss_LoaderChecksStored ProcedureSupports ss_Loader
ss_LoggerStored ProcedureSupports Logging
ss_MetaFieldStored ProcedureReturns Field metadata
ss_MetaObjectStored ProcedureReturns Object metadata
ss_MetaPickStored ProcedureReturns Picklist metadata
ss_ObjectLogStored ProcedureSupports Logging
ss_PullChecksStored ProcedureSupports ss_Replica & ss_Delta
ss_ReplicaStored ProcedureFull Replication of Salesforce data
ss_ReplicaAllStored ProcedureFull Replication of Salesforce data (all objects)
ss_UserInfoStored ProcedureMiscellaneous user information for a given Environment
ss_18FunctionHelper function to generate the full 18 character case insensitive Salesforce Id from a 15 character case sensitive Id.
ss_AutoReplicaTableControls if a given Object is automatically fully replicated when calling ss_DeltaAll
ss_BulkAPILogTableLog table used by ss_Loader and the Bulk API
ss_LogTableLog table for all SQL Sales Delta and Full replications for a given Salesforce object
ss_Log_WorkingTableFiner logging detail to ss_Log
ss_ObjectExclusionTableControl which objects are excluded from ss_ReplicaAll and ss_DeltaAll
ss_ObjectInclusionTableControl which objects are included from ss_ReplicaAll and ss_DeltaAll
ss_SysFieldTableOutput from ss_MetaField
ss_SysObjectTableOutput from ss_MetaObject
ss_SysPicklistTableOutput from ss_MetaPicklist
ss_SystemTableContains the deployed SQL Sales Version
ss_LoaderDefinitionFunctionSupports ss_Loader
ss_SchemaDefinitionFunctionSupports ss_Replica & ss_Delta

Full Schema isolation support #

SQL Sales can run in separate schema on the same databases, which can be helpful for certain use cases or where for example you can only operate in one database and need to have different sandboxes replicated to different schemas, even if necessary having Production replication in their own “prod” schema (although generally speaking as best practise we would advise to physically separate a Production replication to its own dedicated database and ideally to its own SQL Server), that said we recognise some customers have to operate within very restricted SQL environments, which is why full schema isolation can be a real benefit.

Setup #

When enabling a given database, simply change the highlighted code block, specifying your required schema (unless the default dbo schema is required in which case do nothing). Now execute the script.

Working with schemas #

As with standard SQL Server, you do not need to specify the dbo schema when calling stored procedures or selecting from tables, if that is the schema you specified on your given installation (which is the usual default), hence using ss_Replica as an example:

exec ss_Replica 'DEMO', 'Account'
select * from Account

you can, if you prefer also run as

exec dbo.ss_Replica 'DEMO', 'Account'
select * from dbo.Account

Let’s say you have enabled with schema “uat” (for a User Acceptance Testing sandbox) and a second schema called “dev”(for a Development sandbox), you can run the below:

exec uat.ss_Replica 'UAT_SBOX', 'Account'
exec dev.ss_Replica 'DEV_SBOX', 'Account'

and thereby create physically separate replicas in tables:

uat.Account
dev.Account

select * from uat.Account
select * from dev.Account

#

Leave a comment

Your email address will not be published. Required fields are marked *