Previous Topic: Create a Sybase DatabaseNext Topic: Install CA ERwin Mart Server


Transact-SQL Commands

If a graphical DBMS access tool is not available, you can use Transact-SQL commands through ISQL.

Example: Create a device using the Transact-SQL DISK INIT command through ISQL

DISK INIT NAME = 'mmdata',	/* The logical name. */
PHYSNAME = 'C:\SQL\DATA\mmdata.dat',	/* The physical name. */
VDEVNO = 1<= virtual_device_number => 255	
/* System dependent. */
 SIZE = number_of_2K_blocks	/* 1024 here is 2MB!!! */
 [, VSTART = virtual_address,	/* Optional */
CNTRLTYPE = controller_number]	/* Optional */

Example: Create a database using the Transact-SQL CREATE DATABASE command through ISQL

CREATE DATABASE mmmaster	
 [ON {DEFAULT | database_device} [= size_in_megabytes] /* The device created in #1. */
 [, database_device [= size_in_megabytes]]...]  /* A database can span devices. */
 [LOG ON database device [= size_in_megabytes>]  /* Separate log device. */
 [, database device [= size_in_megabytes]]...] /* A transaction log can span devices. */

Example: Add logins to the database with the sp_addlogin and sp_adduser commands using Transact-SQL through ISQL

sp_addlogin login_id [, passwd [, defdb [, deflanguage]]]
sp_adduser login_id [, username [, grpname]]

After you execute these commands, the DBA can alias an existing login as the Database Owner (dbo) or change the dbo to an existing login using sp_changedbowner. Use ISQL to execute the following:

sp_changedbowner login_id [,true] 

Back to Top