Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Subject

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-01-08 : 12:48:09
Glen writes "Using: IIS4 on MS SQL 7

I've written an ASP script that creates a table using the CREATE SQL command.

I've managed to replicate everything I would normally do through the GUI using the CREATE command fine, except one foreign key constraint setting known as "Enable relationship for replication".

If you create a FK between two tables in the diagram area of SQL7 and select Properties, then the Relationships tab SQL7 automatically checks the bottom two checkboxes.

I bsaically need to uncheck the "Enable relationship for INSERT and UPDATE".

I want to do this because the FK is a same-table constraint and can be left blank.

What I can not do is mirror this in my CREATE command

My statement looks like this;
(the last line in this statement is where I am having the trouble)

CREATE TABLE EDMS1 (
id INT IDENTITY(1,1),
jobsid INT NOT NULL,
parentid INT,
thread BIT NOT NULL,
deleted BIT NOT NULL,
randomno INT NOT NULL,
usersidcreated INT NOT NULL,
datecreated DATETIME NOT NULL,
usersidupdated INT,
dateupdated DATETIME,
extension VARCHAR(50),
Name VARCHAR(50) NOT NULL,
Description VARCHAR(50),
Text TEXT,
CONSTRAINT PK_EDMS1 PRIMARY KEY (id),
CONSTRAINT FK_EDMS1_Users_1 FOREIGN KEY (usersidcreated) REFERENCES Users (id),
CONSTRAINT FK_EDMS1_Users_2 FOREIGN KEY (usersidupdated) REFERENCES Users (id),
CONSTRAINT FK_EDMS1_EDMS1_1 FOREIGN KEY (parentid) REFERENCES EDMS1 (id)
)

Hope you can help, many thanks

Glen."
   

- Advertisement -