Creating a SQL Database

Code to create a database:

String sMsg sPath
integer iDBExist iError
handle hoWorkspace
Get phoWorkspace of (oWorkspace(oApplication(self))) To hoWorkspace Get psSQLDataPath of hoWorkspace to sPath
//Create database if not exist
SQL_START_TRANSACTION_STMT
SQL_SET_STMT    To (" if not exists (select * from master.dbo.sysdatabases where name = '" + sDataBase + "')")
SQL_APPEND_STMT To ("    CREATE DATABASE "  + sDatabase)


SQL_PREPARE_STMT
SQL_EXECUTE_STMT

SQL_SET_STMT     To ("Select Count(*) from master.dbo.sysdatabases where name = '" + sDataBase + "'")
SQL_PREPARE_STMT
SQL_EXECUTE_STMT
SQL_FETCH_NEXT_ROW Into iDBExist
SQL_COMMIT_STMT

 

Why Migrate from Btrieve to PostgreSQL and other Relational Databases?

Why Migrate from Btrieve to PostgreSQL and other Relational Databases?

Introduction Many independent software vendors (ISV) and corporate users still rely on applications that use a category of database collective called...

Read More
Four Challenges in Converting COBOL Applications from ISAM Databases to Relational Databases

Four Challenges in Converting COBOL Applications from ISAM Databases to Relational Databases

COBOL applications are the foundation of numerous essential business functions, especially within the banking, insurance, and government sectors....

Read More
Application Modernization 101: Ultimate Guide to Digital Transformation

Application Modernization 101: Ultimate Guide to Digital Transformation

Imagine breaking free from the constraints of old, monolithic systems and embracing the agility and innovation of cloud-based solutions.

Read More