Determining If Foreign Key Constraint Exists

Jul 20, 2005

Hello,
I'm working with a number of databases. I need a way to determine if a
foreign key with given name exists and determine what tables and
fields are linked to it. Any ideas?

I know I can issue the following statement to get a list of the fields
that are constrained by a foreign key constraint.

SELECT * FROM INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE

How can I get a list of fields pointed to by the constraints?

Thanks,
Will
Join Bytes!

View 1 Replies


ADVERTISEMENT

Determining If A Table Exists

May 2, 2000

How do I find out if a temporary table named '##test' exists? I have a stored
procedure that creates this table and if it exists another stored procedure
should do one thing, if it does not exist I want the SP to do something else.
Any help as to how I can determine if this table exists at the current time
would be greatly appreciated.

Thanks in advance for you help,
Jon

View 6 Replies View Related

Determining If A Local Variable Exists

Jun 11, 2007

Is there a way to determine if a local variable exists or not?

There's a parameter I often use in code called @guid_batch that is usually declared in the parameter of a stored proc, but when in debugging it would be nice to have it available without having to change code.

Is there something that I could do similar to the following


Code:


IF VARIABLE_ID('@guid_batch') IS NULL
BEGIN
DECLARE @guid_batch UNIQUEIDENTIFIER
SELECT @guid_batch = NEWID()
END



Thanks in advance,
-MBirchmeier

View 8 Replies View Related

Determining If A Parameter Exists In A Stored Procedure

Jul 20, 2005

Hey,I'm writing some automated unit tests for a database app. The appcreates a database via script. I'm developing the system in atest-driven manner and need a way to determine if a parameter existswithin a stored procedure using SQL. Any ideas?Thanks,WillJoin Bytes!

View 3 Replies View Related

Foreign Key Constraint

Aug 11, 1999

student --- enrollment is 1- to - many . ssn is pk in student. ssn and courseid is pk in enrollment. later I added the foreign key constraint FK_SSN in enrollment table reference student table. it is ok.
enrollment --- lessonhistory is 1-to -many, ssn, courseid and lessonid is pk in lessonhistory . I tried to set FK_SSN foreign key constraint in lessonhistory table reference enrollment table, it always show error message " no primary key in referewnce talbe enrollment "
I don't know how to fix it. could you help me out, thanks!!

View 1 Replies View Related

Foreign Key Constraint

Nov 20, 2011

I have a created a database with nearly 20 tables in it, so I cannot post all of my statements. I am having an issue though with two tables' referential integrity when it comes to foreign key constraints. I want to constrain them to cascade updates from the primary key tables, but I keep getting the error msg 1785

Introducing FOREIGN KEY constraint 'FK__PURCHASE___ITEM___64F971E5' on table 'PURCHASE_ORDER_LINE' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.

Here is the table with the primary key:
create table MERCHANDISE (
ITEM_ID varchar (8) NOT NULL PRIMARY KEY,
DESCRIPTION CHAR (60),
STANDARD_PRICE MONEY,

[code]...

I have tried making an update trigger but it does not work.

View 3 Replies View Related

Foreign Key Constraint

Apr 25, 2006

i have a publication that is composed of

many articles. The publication is composed of many

realated tables. I'm doing a snapshot replication



Is there a way to specify the order by which table

must synchonize.



lets say. article 1 synchonizes first, then article 3, then article 2



View 1 Replies View Related

DTS And Foreign Key Constraint Problem

Jan 3, 2002

Hi

I am attempting to write a DTS package that copies the data across from one instance of a db on a test server to a second instance on to the live server. It has to replace all the exisiting date so I can't append. Unfortunately, the package keeps giving me errors all of the type "unable to truncate tbl due to foreign key constraints". Is there a way round this?

Thanks

Steve

View 2 Replies View Related

Disabling FOREIGN KEY Constraint...

Jan 11, 2007

sql 2000, northwind databse

code in sql analyzer:


Code:


ALTER TABLE categories NOCHECK CONSTRAINT ALL
TRUNCATE TABLE categories
ALTER TABLE categories CHECK CONSTRAINT ALL



but still i am getting the error:

Quote: Server: Msg 4712, Level 16, State 1, Line 2
Cannot truncate table 'categories' because it is being referenced by a FOREIGN KEY constraint.

what i need to do is write a query that just cleans all the tables of all data.

View 4 Replies View Related

Introducing FOREIGN KEY Constraint

Feb 10, 2004

"Introducing FOREIGN KEY constraint 'FK__APPLICANTMA__SEX__414EAC47' on table 'APPLICANTMASTER' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints."


ive a foreign key reference on the table APPLICANT MASTER
of the form
FOREIGN KEY (SEXCODE) REFERENCES
APPLICANTSEX(SEXCODE)
ON DELETE NO ACTION
ON UPDATE CASCADE,


can any one help me WHAT THE MESSAGE MEANS ?

View 5 Replies View Related

Foreign Key Constraint Error

Apr 9, 2008

Hi all, I'm new here so I hope this is the right place to post!!

I'm having a really big problem trying to make a table. I'm not new to the coding, but I'm no expert either.... as far as I can see I haven't done anything wrong...

I have many tables, but the first two are JobDetails and Promotions... in JobDetails, there is a primary key Job which needs to link to Promotions as a foreign key.... here is my code and errors, I'd really appreciate some help...


create table JOBDETAIL
(Job varchar2(15) primary key,
Dept varchar2(10) not null,
Salary number(7) not null);


create table PROMOTION
(PCID number(6) primary key,
PDate date,
Constraint fkey_p1 foreign key (Job) references JOBDETAIL(Job));

ERROR at line 4:
ORA-00904: "Job": invalid identifier



... any help would be appreciated, this is quite important... thank you!!!

View 1 Replies View Related

Need Help Adding Foreign Key Constraint

Dec 13, 2007

Here is my sqlce:




Code Block

alter table tblV
add constraint
foreign key (T_ID)
references tblT(T_ID)
on delete set null on update cascade
Error is:
Major Error 0x80040E14, Minor Error 25501
There was an error parsing the query. [ Token line number = 3,Token line offset = 1,Token in error = foreign ]

I'm new with SQL Mobile, so sorry for the novice question.

Thanks

View 5 Replies View Related

Foreign Key Constraint Conflict

Jan 21, 2007

Hi,
I am fairly new to SQL server Express and I have quite a simple database set up and I am trying to test it out with data. I have €śPain Reading€? and €śWorsen Factors€? tables with a 1: M relationship. The primary key in the Pain reading table is ReadingID which is being set using getdate() for the default value. I am getting the following error when attempting to add a new row to the €śWorsen Factors€? table:

No row was updated

The data in row 1 was not committed.
Error source:.Net SqlClient Data Provider
Error Message: The insert statement conflicted with the FOREIGN KEY constraint "FK_WorsenFactor_PainReading1". The confilct occurred in database "paindata", table "dbo.PainReading", column 'ReadingID'.
The statement has been terminated.

Any help or suggestions would be very helpful.

Thanks

View 4 Replies View Related

Creating Foreign Key Constraint

Aug 1, 2007

I have two tables; each has multi-column primary keys. I need to create a foreign key relationship between the two tables.

Sales:
DKey, int, PK
OKey,int, PK
RKey,int, PK
...

Rep:
Bkey, int, PK, identity
Rkey, int, PK
...

When I try to like Rkey from both tables as a foreign key relationship, I get an error that the columns in one table "do not match an existing primary key or UNIQUE constraint. (I've tried it both ways and get the same error.)

How can I link these two tables?

Thanks.

View 7 Replies View Related

Error FOREIGN KEY Constraint

Dec 3, 2007



Hi,
i have two tables, one is department-Table(Master table) and other is employee-table(Child table).
DNO is a data field which is common in both the table. "DNO" is primary key in department-table and "DNO" is foreign key in child table.

I am trying to insert rows in the table i found the following error:

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Employee_Department". The conflict occurred in database "Project", table "dbo.Department", column 'Dno'.

What's the solution to replace this error

Thanks.

View 4 Replies View Related

Foreign Key Constraint Issue..please Help

Oct 11, 2006

Hi there

Yesterday I made alot of updates to to various tables within a databse, to update some records I had to drop the foreign key constraint, but when I try to add the constraint back I get an error message (in red)
ALTER TABLE [dbo].[ITEMS] ADD
CONSTRAINT [FK_ITEMS__ITEM_CATEGORIES] FOREIGN KEY
(
[ITC_ID]
) REFERENCES [dbo].[ITEM_CATEGORIES] (
[ITC_ID]
) ON UPDATE CASCADE NOT FOR REPLICATION ,
CONSTRAINT [FK_ITEMS__ITEM_TYPES] FOREIGN KEY
(
[ITY_ID]
) REFERENCES [dbo].[ITEM_TYPES] (
[ITY_ID]
) ON UPDATE CASCADE NOT FOR REPLICATION
GO
Server: Msg 1785, Level 16, State 1, Line 1
Introducing FOREIGN KEY constraint 'FK_ITEMS__ITEM_CATEGORIES' on table 'ITEMS' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
Server: Msg 1750, Level 16, State 1, Line 1
Could not create constraint. See previous errors

any suggestions? I tried modifying the statement to ON UPDATE NO ACTION, but I get exactly the same error message.
Any help would be much appreciated...thanks in advance

View 3 Replies View Related

Override A Foreign Key Constraint

Aug 9, 2007

A website that I'm working on has users sign in and keeps a log of the pages they go to. The log table has a foreign key in it that links to the username is the users table. I need to update the username for one of the users but the foreign key is preventing me from doing so. What is the benefit of having a foreign key like this? Can I delete it to update the username or is there a better way?

View 1 Replies View Related

Foreign Key Constraint- Reference 1 Of 2 Tables

Nov 2, 2007

Hi,
I don't know if this is possible, i believe not, so I'm here to ask the experts if is possible to have a foreign key constraint that references the key of one of two tables.
Like this:
I have 3 tables: TABLE X, TABLE A and TABLE B
Is it possible to the FK on TABLE X refernce the PK of TABLE A OR TABLE B?
If yes, how can I do this?
If not, I need to have a fourth table, so TABLE X references TABLE A and TABLE Y references TABLE B.
Thanks!

View 4 Replies View Related

Foreign Key Constraint To A Composite Primary Key

Mar 6, 2008

I have two tables: table 1 and table 2. The primary key of table is composite key of two collumns and table 2 is the child of parent table 1. Is it possible to create / define a foreign key constraint using a composite primary key?

View 10 Replies View Related

Urgent!drop Foreign Key Constraint

Mar 1, 2001

I have to drop foreign key constraint from one table. How can I do that? Is it possible?
Also,

Is it possible to add a foreign key constraint on the table once it has a data?

View 1 Replies View Related

Column Foreign Key Constraint 'EOR_ITE_REF_EOR'

Mar 17, 2004

I am importing data from a flat, comma delimited text file. It appears to properly import all the records and then on the last record it give me the error

INSERT statement conflicted with COLUMN FOREIGN KEY constraint for 'EOR_ITE_REF_EOR'.

Then it goes on to tell me the database, table and column in which the problem occured which is the first column in the table. It looks like it doesn't like the end of the file for some reason (EOR, end of record?) so I tried deleting the last record from the file and it still does it. I do have a file that I have imported that worked so I tried copying the last record of that file and pasting it into the last record of the file I wanted but that did not work either. The ends of file that works and the file that doesn't work look the same and I can find nothing on 'EOR_ITE_REF_EOR'. Any help would be appreciated.

View 1 Replies View Related

Create A Foreign Key To Unique Constraint?

Jul 3, 2015

why it is not possible to create a Foreign key to a Unique constraint?

Table A has column 1 holding a Primay key and two columns (2 and 3) holding a Unique combination (and some more columns).He created an Unique constraint on column 2 and 3 together.

He wanted to use this Unique combination to point to table B (instead of the table 1's PK) so he tried to create a foreign key on a column in table B but an error popped up prompting;

The columns in table 'TABLE_A' do not match an existing primary key or UNIQUE constraint.

Ok - these two columns ar no PK but the hold an Unique constraint......

View 2 Replies View Related

Enforcing Foreign Key Constraint On Tables

Mar 5, 2008

Greetings all!

How can I enforce a foreign key constraint when I have two tables each one residing on a different database?

Thanks for your help in advance.

View 1 Replies View Related

Adding A Column With Foreign Key Constraint

Oct 1, 2007



Hello!


I am trying to alter a table adding a column with foreignkey constraint. The table that holds the primary key in that relation has data, so i am not being able to execute the alter statement.

This is the error:


Server: Msg 547, Level 16, State 1, Line 1
ALTER TABLE statement conflicted with COLUMN FOREIGN KEY constraint 'FK_MOPAeroportoICAO_IDMOPAlimentacaoFerroviaTipo'. The conflict occurred in database 'MOP', table 'MOPAlimentacaoFerroviaTipo', column 'IDMOPAlimentacaoFerroviaTipo'.

This is the script:

ALTER TABLE MOPAeroportoICAO
ADD IDMOPAlimentacaoFerroviaTipo [int] DEFAULT 0 NOT NULL
CONSTRAINT [FK_MOPAeroportoICAO_IDMOPAlimentacaoFerroviaTipo] FOREIGN KEY
REFERENCES MOPAlimentacaoFerroviaTipo (IDMOPAlimentacaoFerroviaTipo)

How can i turn of check when i add the foreign key ?

Thanks in advance

View 1 Replies View Related

Problem Creating A Foreign Key Constraint

Feb 8, 2007

Hello, I'm having some problems trying to create this foreign key constraint:

ALTER TABLE dbo.t2_demaclie
ADD CONSTRAINT FK03_T2_DEMACLIE FOREIGN KEY (dclPerfilCompania, dclOrdenPedido)
REFERENCES DBO.T2_PEDIDOCLIENTE (cdPerfilCompania, nmOrdenPedido)


Server: Msg 547, Level 16, State 1, Line 1
ALTER TABLE statement conflicted with TABLE FOREIGN KEY constraint 'FK03_T2_DEMACLIE'. The conflict occurred in database 'Comfruta_dllo', table 't2_pedidoCliente'.



I'm sure there's no other constraint with the same name, and there's no othe one with the same columns...


Thanks a lot !!

View 6 Replies View Related

Updating A Table Having A Foreign Key Constraint

Nov 10, 2006

Hi

I am trying to update tables "Table A" & " TableB" with a new value for a particular column1. Now "TableA" contains a foreign key "FK1" defined on it and is referencing another table "Table B" containing the similar column "Column1"

Because of this constraint I was not able to update TableA and TableB. My question is

1) If i wanted to go ahead with this update, what are the possible ways?

2) If only solution is to drop the constraint. Then How do i know the definition for this particular Foreign key, i mean it may refer some columns in Table B. I wanted to know the complete definition of it so that i can rebuild the constraint after the update. Right now i can see only the constraint name when i use sp_help TableA. But how do i know the complete reference made by this foreign key.



Early reply is much appreciated



Thanks!

View 3 Replies View Related

Programatically Finding If A Row Has A Foreign Key Constraint

Jul 11, 2006

Hello,

Does anyone know a way from within a .net application to find out if a row has a foreign key constraint before updating it? Or possibly in a SQL Stored Procedure if necessary.

What I am trying to do is basicly simulate a delete of a row in a SQL 2005 database from a .net application. Instead of actually deleting the row I want to set a bool column as deleted. The problem is that I can't orphan records that have a relationship to the one deleted.

This is normaly taken care of automaticly with refrential integrity working properly, but not actually calling delete comands I can't seem to find that out without writing a lot of code to check manually in other tables for that key.

Any help would be appreciated greatly,

Thanks,

Patrick

View 3 Replies View Related

INSERT Statement Conflicted With The FOREIGN KEY Constraint

Mar 7, 2008

Hello Friends
           How are you?? Friends i am getting problem in SQL Server 2005. I am deployng web application on production server as well as Databse also. In production server i inserted new field in all tables which is rowguid and its type is uniqueidentifier. The default binding for this field is newsequentialid(). In some pages it works ok but in some places it generates error like which is describe below:
Error:
System.Data.SqlClient.SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_TransactionDetails_TransactionMain". The conflict occurred in database "dbname", table "dbo.TransactionMain", column 'TransactionMainID'. The INSERT statement conflicted with the FOREIGN KEY constraint "FK_TransactionDetails_TransactionMain". The conflict occurred in database "dbname", table "dbo.TransactionMain", column 'TransactionMainID'. The INSERT statement conflicted with the FOREIGN KEY constraint "FK_TransactionDetails_TransactionMain". The conflict occurred in database "dbname", table "dbo.TransactionMain", column 'TransactionMainID'. The INSERT statement conflicted with the FOREIGN KEY constraint "FK_TransactionDetails_TransactionMain". The conflict occurred in database "dbname", table "dbo.TransactionMain", column 'TransactionMainID'. The INSERT statement conflicted with the FOREIGN KEY constraint "FK_TransactionDetails_TransactionMain". The conflict occurred in database "dbname", table "dbo.TransactionMain", column 'TransactionMainID'. The statement has been terminated. The statement has been terminated. The statement has been terminated. The statement has been terminated. The statement has been terminated. at MyGeneration.dOOdads.BusinessEntity.LoadFromSql(String sp, ListDictionary Parameters, CommandType commandType) at MyGeneration.dOOdads.BusinessEntity.LoadFromSql(String sp, ListDictionary Parameters) at LCO.pname.DAL.BLL.AccountInfo.funName(Parameters) 
In above mentioned error, foreign key is availabe in child table. Can anybody help me to solve this problem. Its urgent so plz reply me as soon as possible. I'll be very thankfull to you. Thanks in Advance.
 Regards,

View 1 Replies View Related

The INSERT Statement Conflicted With The FOREIGN KEY Constraint 'Table'

Jan 11, 2008

 Hi,A conflict error occured when I insert data using Formview.The INSERT statement conflicted with the FOREIGN KEY constraint "FK_personal_personal_category". The conflict occurred in database "E:INETPUBWWWROOTWEBSITEAPP_DATADATABASE.MDF", table "dbo.personal_category", column 'cat_id'.The statement has been terminated. ----------------------------------------------------Personal TablepID (primary)pNamecat_id (foreign key from personal_category, which has a relationship with it's primary key cat_id)pID | pName | cat_id1 | Scott | 112 | John | 122 | Mick | 13-----------------------------------------------------Personal_Category Tablecat_id (primary)cat_Descriptioncat_id | cat_description11 | Dean12 | Student13 | Professor-----------------------------------------------------I'm inserting a new data on Personal Table while choosing a category usinga DropdownList which is binded to another DataSource (LinqDataSource2).... <asp:FormView ID="FormView1" runat="server" DataKeyNames="tut_id" DataSourceID="LinqDataSource1"            BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px"            CellPadding="4" DefaultMode="Insert" ForeColor="Black" GridLines="Vertical">            <FooterStyle BackColor="#CCCC99" />            <RowStyle BackColor="#F7F7DE" />            <InsertItemTemplate>            <asp:TextBox ID="pName" runat="server" Text='<%# Bind("pName") %>' />            <br />            <asp:DropDownList ID="DropDownList1" runat="server"                  DataSourceID="LinqDataSource2" DataTextField="cat_desc" DataValueField="cat_id" DataSource='<%# Bind("tut_cat") %>' >            </asp:DropDownList>            </InsertItemTemplate>            <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />            <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />            <EditRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" /> </asp:FormView>        <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="PersonalsDataContext"            TableName="Personal" EnableInsert = "true">                     </asp:LinqDataSource>        <asp:LinqDataSource ID="LinqDataSource2" runat="server" ContextTypeName="PersonalCategoriesDataContext"            TableName="Personal_categories" EnableInsert="false" >        </asp:LinqDataSource>...  Hope you could help.cheers,imperialx 

View 2 Replies View Related

INSERT Statement Conflicted With COLUMN FOREIGN KEY Constraint...

Feb 18, 2006

Hi there,
I have a stored procedure which i pass a number of parameters into. One of these parameters is staffNo (only passed this in because i couldn't execute the query without it). The thing is this field can be Null, but when trying to pass null into it it comes up with an Foreign Key conflict. staffNo is a foreign key within the table i'm inserting the data into.
This is the error i get:
"INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'PropStaffFK'. The conflict occurred in database 'DewMountain', table 'TblStaff', column 'staffNo'. The statement has been terminated. The 'PropertyAdvert' procedure attempted to return a status of NULL, which is not allowed. A status of 0 will be returned instead. "
 
Does anyone know of away around this? how to pass a null value to the stored procedure without it causing this error.
Thank you
Melanie

View 13 Replies View Related

How To Add A Foreign Key Constraint Using The SQL Server 2000 Enterprise Manager

Jul 23, 2005

Hi,How to add a foreign key constraint using the SQL server 2000enterprise manager?Not by SQL.thanks

View 3 Replies View Related

DB Engine :: INSERT Statement Conflicted With FOREIGN KEY Constraint

Dec 3, 2013

I get this error when inserting data..The INSERT statement conflicted with the FOREIGN KEY constraint FK_Participant_ Log_BiometricInstance_ Participant_ Activities". The conflict occurred in database "ProvantCustomerPortal", table "dbo.Activities", column 'Id'.The statement has been terminated.

My query looks like this :

insert into [dbo].[Participant_BiometricInstance](ParticipantId, ActivityId, ProviderTypeId, Fasting, ExternalSystemId, ResultsDate, ModifiedBy, ModifiedDate)
select participantID,'','','',NULL,getdate(),NULL,getdate() from [dbo].[Participant_Profile]

[code]....

View 11 Replies View Related

The INSERT Statement Conflicted With The FOREIGN KEY Constraint FK_source_destination.

Aug 6, 2007

Hi.

Please excuse the rookie question, but I am not sure how to get around this error.

"The INSERT statement conflicted with the FOREIGN KEY constraint "FK_users_editprofile". The conflict occurred in database "MyDB", table "dbo.editprofile", column 'userid'.
The statement has been terminated."


I encountered the error when running a series of test INSERT statements after creating a bunch of FK/PK relationships
between the parent table DBO.USERS and several child tables. The one that this error complains about is DBO.EDITPROFILE.






Code Snippet

INSERT INTO users (lastname, firstname, email, alternateemail, password, role, securityquestion, securityanswer, zipcode, birthmonth, birthday, birthyear, gender, city, state, country, registerdate, editdate, confirmed)
VALUES('gore', 'albert', 'bigal@inconvenienttruth.org', null, 'hugatree', 'User', 'what is your school?', 'harvard', 06510, 1, 31, 1970, 'Male', 'Greenwich', 'Connecticut', 'USA', '2007-06-22', null, 1)

INSERT INTO precedence (userid, profileid, searchname, proximity)
VALUES(1, 3, 'random search', 1)

INSERT INTO userphotos (photoname, userid, location, size, caption, isdefault, ispublic, date, nophoto)
VALUES('random image', 1, 'x/y/z/', 23422, 'random', 0, 1, '1998-12-25', 0)

INSERT INTO editprofile(headline, aboutme, userid, date, interests)
VALUES('Random Headline', 'random', 1, '1998-12-25', 'I am interested in anything random')

DBO.USERS:





Code Snippet

CREATE TABLE [dbo].[users](
[userid] [int] IDENTITY(1,1) NOT NULL,
[lastname] [varchar](50) NULL,
[firstname] [varchar](50) NULL,
[email] [varchar](50) NOT NULL,
[alternateemail] [varchar](50) NULL,
[password] [varchar](50) NOT NULL,
[role] [char](50) NOT NULL,
[securityquestion] [varchar](50) NOT NULL,
[securityanswer] [varchar](50) NOT NULL,
[zipcode] [int] NOT NULL,
[birthmonth] [tinyint] NOT NULL,
[birthday] [tinyint] NOT NULL,
[birthyear] [int] NOT NULL,
[gender] [char](10) NULL,
[city] [varchar](50) NULL,
[state] [varchar](50) NULL,
[country] [varchar](50) NULL,
[registerdate] [datetime] NOT NULL,
[editdate] [datetime] NULL,
[confirmed] [bit] NULL CONSTRAINT [DF__Users__confirmed__4CC05EF3] DEFAULT ((0)),
CONSTRAINT [PK_users] PRIMARY KEY CLUSTERED
(
[userid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
CONSTRAINT [IX_email] UNIQUE NONCLUSTERED
(
[email] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[users] WITH NOCHECK ADD CONSTRAINT [FK_users_editprofile] FOREIGN KEY([userid])
REFERENCES [dbo].[editprofile] ([userid])
GO
ALTER TABLE [dbo].[users] CHECK CONSTRAINT [FK_users_editprofile]
GO
ALTER TABLE [dbo].[users] WITH NOCHECK ADD CONSTRAINT [FK_users_lastlogin] FOREIGN KEY([userid])
REFERENCES [dbo].[lastlogin] ([userid])
GO
ALTER TABLE [dbo].[users] CHECK CONSTRAINT [FK_users_lastlogin]
GO
ALTER TABLE [dbo].[users] WITH NOCHECK ADD CONSTRAINT [FK_users_precedence] FOREIGN KEY([userid])
REFERENCES [dbo].[precedence] ([userid])
GO
ALTER TABLE [dbo].[users] CHECK CONSTRAINT [FK_users_precedence]
GO
ALTER TABLE [dbo].[users] WITH NOCHECK ADD CONSTRAINT [FK_users_savedsearches] FOREIGN KEY([userid])
REFERENCES [dbo].[savedsearches] ([userid])
GO
ALTER TABLE [dbo].[users] CHECK CONSTRAINT [FK_users_savedsearches]
GO
ALTER TABLE [dbo].[users] WITH NOCHECK ADD CONSTRAINT [FK_users_userphotos] FOREIGN KEY([userid])
REFERENCES [dbo].[userphotos] ([userid])
GO
ALTER TABLE [dbo].[users] CHECK CONSTRAINT [FK_users_userphotos]




DBO.EDITPROFILE





Code Snippet

CREATE TABLE [dbo].[editprofile](
[editprofileid] [int] IDENTITY(1,1) NOT NULL,
[headline] [varchar](50) NULL,
[aboutme] [text] NULL,
[userid] [int] NOT NULL,
[date] [datetime] NOT NULL,
[interests] [text] NULL,
CONSTRAINT [PK_EditProfile] PRIMARY KEY CLUSTERED
(
[date] ASC,
[userid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

View 6 Replies View Related







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