I used this script to generate tables. The tables generated fine, now when I try to run the script for stored procedures.
Here is the script for the tables:
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'{databaseOwner}[{objectQualifier}YourCompany_AUDIX]') and OBJECTPROPERTY(id, N'IsTable') = 1)
DROP TABLE {databaseOwner}[{objectQualifier}YourCompany_AUDIX] GO CREATE TABLE {databaseOwner}[{objectQualifier}YourCompany_AUDIX] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [ModuleID] [int] NULL , [Name] [nvarchar] (50) NULL , [Branch] [nchar] (10) NULL , [HomePhone] [nchar] (10) NULL , [CellPhone] [nchar] (10) NULL , [TimeEntered] [timestamp] NULL, [DateEntered] [datetime] NULL, [Notes] [nvarchar] (250) NULL ) ON [PRIMARY]
ALTER TABLE {databaseOwner}[YourCompany_AUDIX] ADD CONSTRAINT [PK_{objectQualifier}YourCompany_AUDIX] PRIMARY KEY CLUSTERED ( [ID] ) ON [PRIMARY]
Here is the script to generate the stored procedures:
CREATE PROCEDURE {databaseOwner}[{objectQualifier}YourCompany_AUDIX_Delete] ( @ID int ) AS DELETE FROM {objectQualifier}YourCompany_AUDIX WHERE (ID = @ID) RETURN GO
CREATE PROCEDURE {databaseOwner}[{objectQualifier}YourCompany_AUDIX_GetAll] ( @ModuleID int ) AS SELECT ID, ModuleID, Name, Branch, HomePhone, CellPhone, Notes FROM {objectQualifier}YourCompany_AUDIX WHERE (ModuleID = @ModuleID) order by DateEntered DESC RETURN GO
CREATE PROCEDURE {databaseOwner}[{objectQualifier}YourCompany_AUDIX_Insert] ( @ModuleID int, @Name nvarchar(50), @Branch nchar (10), @HomePhone nchar (10), @CellPhone nchar (10), @Notes nvarchar(250) ) AS INSERT INTO {objectQualifier}YourCompany_AUDIX (ModuleID, Name, Branch, HomePhone, CellPhone, Notes) VALUES (@ModuleID,@Name,@Branch,@HomePhone,CellPhone, getdate()) RETURN GO
CREATE PROCEDURE {databaseOwner}[{objectQualifier}YourCompany_AUDIX_Update] ( @ID int, @Name nvarchar(50), @Name nvarchar(50), @Branch nchar (10), @HomePhone nchar (10), @CellPhone nchar (10), @Notes nvarchar(250) ) AS UPDATE {objectQualifier}YourCompany_AUDIX SET Name = @Name, Branch = @Branch, HomePhone = @HomePhone, CellPhone = @CellPhone, Notes = @Notes, DateEntered = @DateEntered, TimeEntered = @TimeEntered WHERE (ID = @ID) RETURN GO
|