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

 

Data Security with Flex2SQL and BTR2SQL Connectivity Products

Data Security with Flex2SQL and BTR2SQL Connectivity Products

The most common reason for Enterprises looking to migrate from legacy Btrieve or DataFlex databases is the urgent need to address security and...

Read More
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