Problem With A Foreing Key

Jul 20, 2005

I'm a beginner in using SQLServer and I 'm trying to bring a db Schema
written for DB2 into SQLServer.
My problem is this: using a tool to translate the script for creating the
DB, I obtain the following code:

ALTER TABLE PROJECT.RSURETTA ADD FOREIGN KEY(VOCE )
REFERENCES PROJECT.RSANVOCE(VOCE ) ON DELETE SET NULL ON UPDATE NO ACTION

But, when I try to run the script the system says:

Incorrect syntax near the keyword 'SET'.

Can I assign a null value to an other table with a reference?

Thank you
Fede

View 2 Replies


ADVERTISEMENT

Replication Foreing Key Problem

Mar 14, 2006

Hi,

I want to replicate in the same Server 2 tables, first I test with the same data datbases in other Server but 1 table and all is ok , when I try to do the same in the production server occurs an error, Distibution Agent Error Details show me this: Could not drop object 'SER_CURRENCY' because it is referenced by a FOREIGN KEY constraint. Like I said first I run a test, in this test I check IDENTITY: YES (Not for replication), ENFORCE RELATIONSHIPS FOR REPLICATION is unchecked.

My scenario is:

- Windows XP, SQL Server 2000 Developer Edition sp4.

Please, I want to know other reason for this error. Thanks



- Neyver.

View 1 Replies View Related

How Many Foreing Keys Does A Table Has?

Dec 12, 2007



hi

I could not build a query using the system tables; where I can know how many foreing keys does a specific table has? I´m lost.

can somebody help me... thanks

View 4 Replies View Related

Obtaining Foreing Keys Dependences

Jan 6, 2006

I want to know how to obtain the relationships of foreing keys when they have diferent names in diferent tables using SQL querys from VB.net in SQL Server 2000.

Example:

Table Person
------------
IDPerson
Name
Address


Table Customer
--------------
IDCustomer
.
.
.


Table Employee
---------------
IDEmployee
.
.
.


The dependencies are:

IDPerson--->IDCustomer
IDPerson--->IDEmployee

View 2 Replies View Related

How Can I Split Fields And Depending One Column Decide The Foreing Key

Oct 19, 2007

I´m wondering how to solve the following scenario with SSIS

I have a CITY table and a STATE table, I have to load a file with the information regarding to the CITY:


the state table is like this:


StateCode(PK) stateLegalCode stateName
============= ============== =========
1 01 Florida


the city table is like this:


citycode(PK) cityLegalCode cityname StateCode(FK)
============ ============= ======== =============
1 1001 Quakertown 1


the file has the following information


cityLegalCode cityName
============= ========
01-1001 Quakertown
...

how can I load the file into CITY table:

1-) with the file's cityLegalCode I have to split the string and if the two initial digits are 01 the registry must have 1 in the StateCode(FK).

how can I do something like that using SSIS???

thanks

View 3 Replies View Related

How Can I Export Foreing Key And Primary Key With SQL2005 Management Studio/Database/Tasks/Export Data Wizard.

Jan 4, 2008

How can I Export Database with foreing Key and primary key.

Operation is that
SQL2005 Management Studio/Database/Tasks/Export Data


Before Version is SQL2000 we can Selected Copy Object and data between server and then Use Default Options click checked and Select Copy Index, Copy Foreing Primary key vs vs

But this options is not found in the SQL2005 Management Studio/Database/Tasks/Export Data wizard or I can't found it.

How can I export foreing Key and primary key with SQL2005 Management Studio/Database/Tasks/Export Data wizard.

Best Regards,

Athena.

View 1 Replies View Related

Generate Script For Primary Keys And Foreing Keys

May 16, 2008



Pls let me know How I generate script for All primary keys and foreign keys in a table. Thereafter that can be used to add primary keys and foreign keys in another databse with same structure.

Also how I script default and other constraints of a table?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved