![]() Gravitybox Schedule.NET Users Guide
Page 21
1998-2004 Gravitybox Software LLC
Chapter 3
Integration with an existing Schema
The Enterprise Sever installation allows you to construct applications with the out-of-
the-box table structure and settings. However many times scheduling is only a part of
your overall application. The appointment table that is created by default may not
include all of the fields your application requires. In response to the need, the Enterprise
Server has been built with flexibility in mind. You may modify the database scripts to
create a database with additional fields.
Adding custom database fields
In the following example the Provider table has been modified to have an extra field
named Address. You can add this (and other fields) to describe a provider in more
detail. This field is not included in the default database schema. However it can be
added quite easily.
To accomplish this you need to modify the provider table and its corresponding stored
procedures. First the provider table should be altered to add the new column. The SQL
below add a new column named address as an nvarchar to the table.
ALTER TABLE dbo.PROVIDER
ADD address nvarchar(100) NOT NULL DEFAULT ''
After the table has been modified, the corresponding stored procedures need to be
modified so that the select, update and insert actions are performed correctly on the
table.
In the SQL sample below the bold text indicates changes from the original stored
procedure. The select statement now has an address field being selected as part of the
query.
if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[gb_ProviderSelect]') and OBJECTPROPERTY(id,
N'IsProcedure') = 1)
drop procedure [dbo].[gb_ProviderSelect]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE dbo.gb_ProviderSelect
AS
SELECT
provider_guid,
|