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)
 SQL 7.0 Creating table with constraints

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-06-25 : 08:48:25
Nicu writes "I want to create a database using SQL Server 7.0. I have no prblems in create table, but I don't know how to create a relationship like in MSAccess: ON CASCADE DELETE.

I used a sintax like this:

CREATE TABLE USERS (
id int NOT NULL PRIMARY KEY,
name char(10) NOT NULL
)

CREATE TABLE LOGIN (
id_user int NOT NULL PRIMARY KEY,
passw char(10) NOT NULL,
CONSTRAINT FK_USER_LOGIN
FOREIGN KEY id_user REFERENCES users(id)
ON DELETE CASCADE
)

The problem is that I get an error in syntax: "Incorrect syntax near the keyword 'ON'."

So, I want to have more tables, one of them with primary key and anothers with foreign keys, and when I delete a record from the central table (users) I want all records from the others tables who are linked to this record, to be deleted.

Thank you for your time and please don't forget'me!!

Nicu B"
   

- Advertisement -