Cover V04, I01
Article
Figure 1
Figure 2
Figure 3
Listing 1
Listing 2

jan95.tar


Listing 2: create.index.all--Executes create.index for every user table in the database assigned to the environment variable DATABASE

#-----------------------------------------------------------------------------#
#- Author  of  this  Program:   William Genosa                               -#
#- Program Name and  Release:   @(#)create.index.all  1.1                    -#
#- File  Name  Used by  SCCS:   s.create.index.all                           -#
#- Tested on Sybase Versions:   4.2 and 4.92 for AIX                         -#
#- Last Date of Modification:   94/08/25                                     -#
#-                                                                           -#
#- Description:                                                              -#
#- This simple program is used to execute the create.index program for every -#
#- user table in the database assigned to the environment variable DATABASE. -#
#-----------------------Set The Environment Variables-------------------------#
CONFIG=/home/bill/.config        #- Global variable configuration file.      -#
if [ -f "${CONFIG}" ]            #- If  the  global  variable  configuration -#
then                             #- exists, then use it.    Otherwise set up -#
. ${CONFIG}                   #- the  variables  locally in this program. -#
else
SYBASE=/home/sybase           #- The sybase directory structure location. -#
DSQUERY=CLIENT                #- Locates the server in interface file.    -#
LOGIN=sa                      #- Sybase sa login.                         -#
PASSWORD=guessme              #- The password for sa.                     -#
SERVER=CLIENT                 #- The Sybase SQL Server to access.         -#
DATABASE=accounts             #- The database to access.                  -#
export SYBASE DSQUERY LOGIN PASSWORD SERVER DATABASE
fi

#-----------------------------------------------------------------------------#
#- The for loop below will execute the create.table program and generate the -#
#- sql which would re-create each user table in the database.                -#
#-----------------------------------------------------------------------------#
for table in `echo "set nocount on
go
select name
from ${DATABASE}..sysobjects
where type = 'U'
go" | ${SYBASE}/bin/isql -U${LOGIN} -P${PASSWORD} | \
grep -v "^ name                           $" | \
grep -v "^ ------------------------------ $" | \
grep -v "^$"`
do
/home/bill/create.index ${table}
done

#------------------------------------END--------------------------------------#