.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

How to know foreign key references for a table

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :Sql Server
 
Hi, For a parent table, having a parent id, is it possible to know all the child tables? for e.g if TABLE1 has PK1 as primary key, TABLE2 has PK2 which is a foreign key refering to TABLE1 and TABLE3 also has a foreign key referecing TABLE1 and many others.. is it possible to know all the child tables for table TABLE1?? Thanks,


View Complete Post


More Related Resource Links

How to get all the foreign key references for a primary key

  
Hi ,  I would like to know all the foriegn key references in the db for a table's primary key..How can i get that? Thanks sunil m datla

Inserting null value into foreign key table with allow null enabled

  

Hey guys, 

I have 2 table Table A, Table B.

Table A - Parent Table

ID - Uniqueidentifier not null(PK)

Table B -Child Table              

ID - uniqueidentifier null(FK, TableA)


I have a stored procedure to insert data into Table B, but when I tried to insert a null value into column ID of table B, this error came up:

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tableB_tableA". The conflict occurred in database "database name", table "table A", column 'ID'.

The statement has been terminated.

The insert statement in asp.net is like so:

sqlcommand.parameter.add(New Sqlparameter("ID", Nothing))


I am guessing adding nothing to the null value column is the problem, but i don't know how to fix it... can any1 help me?


Zeph

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tableB_tableA". The co

Add new record to a sql table that has a foreign key relationship using infopath form

  

hi,

it's me again.

i want to know how can i add new records to a sql database table that has a foreign key relationship with another table using infopath form.

i have created a blank form based on database

i have all my fields and the "add new" button already in the form.

i have the username and the userid filled in automatically when the user opens the form.

when i fill in the form with new data and click submit. it gives me this error:

Field or group: BE_CODE
Error: Only integers allowed

this "BE_CODE" field has to be filled in the database table, it can not be null. but it must not be filled in by the user it self. and it is a repeating table so it can not be auto increment.

how can this field also be filled in the database table?


Creating table records with foreign key constraints/Separate controllers?

  

I have multiple tables that are all linked back to a central table with foreign keys. I want to be able to create a new record in table 2, but I'm having trouble because I don't know how to create a new instance of table 2's record while referencing the ID of the record it will be tied to.

EXAMPLE:

The ALTER TABLE statement conflicted with the FOREIGN KEY constraint

  

The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "fk_Allergy". The conflict occurred in database "MSCPROJECT", table "dbo.Severity", column 'SeverityCode'.


multiple foreign keys to same table and same column

  

I am working with two Tables. Table A contains Id, Names. Table B  keeps only the reference to table A by InventoryID1, InventoryID12, InventoryID3.

Table A
-----------
InventoryID
Name
Price

Table B
---------
MenuID
Name
InventoryID1
InventoryID2
InventoryID3

I need a select statement to pull up all items from table B, showing the InventoryID 1, 2, 3 by their corresponding Name on Table A  

At first I thought this would be a simple inner join statement, which it does work when only InventoryID1 is involved
 
select * from Inventory
inner join Menu On (Inventory.InventoryId1 = Menu.Inventory)

The problem arises when I try to obtain the Inventory Name from Table A for the second or third (InventoryID2 or InventoryID3) from Table B. So basically, my problem is how to request a second or third Inventory.Name in the same select statement


Populate foreign key in the table

  

I need to populate the foreign key coloum in the table.

i have three tables

PATIENT DETAILS

ptID

firstName

lastName

address

IMPLANT DETAILS

impID

ptID

productID

productSerialNo

PRODUCT

productID

productName

---------------------------------------------------------------------

I am instering data in PATIENT DETAILS and IMPLANT DETAILS table on the same page from single button click .

I have a foreign key on the table IMPLANT DETAIL (productID) which i populate through the value on the dropdownlist .

What my problem is how will i populate foreign key (ptID) in IMPLANT DETAIL table. When ptID (PATIENT DETAIL) will also be generated from the same button click at almost of the same time.








Export Visio Database Table Names to Excel

  
If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

Insert value using Table Value Functions

  
a real gem in Sql Server 2008. mostly people still using Stored procedure may be they shifted to SQL Server but they are not using TVF right now.

Using jQuery to Filter Table Rows

  
The project is using the .net GridView control, so I had limited control over the output HTML code. Still, I think this code can work for most tables. One thing to notice: you should use the class "filterable" on your table or on one of its parents for the code to work.
First, we need a text box:

RadioButton Groups, Table Rows And NamingContainers in asp.net

  
The RadioButtonList. Very handy for inviting users to select just one item from a list although because of the screen real estate it takes up, used less and less in favour of the DropDownList. In plain HTML, the browser knows to enforce the unique selected value amongst a list of radio buttons because they all have the same value for their name attributes.

RadioButton Groups, Table Rows And NamingContainers

  
(In which AJAX-enhanced CheckBoxes become more useful than RadioButtons but inheritance saves the day, and a simple RadioButton-derived control establishes the purpose of a control's naming container)

The RadioButtonList. Very handy for inviting users to select just one item from a list although because of the screen real estate it takes up, used less and less in favour of the DropDownList. In plain HTML, the browser knows to enforce the unique selected value amongst a list of radio buttons because they all have the same value for their name attributes.

Building a 3-Tier App with Silverlight 3, .NET RIA Services, and Azure Table Storage

  
Silverlight 3, .NET RIA Services, and Windows Azure Services Platform makes a 3-tier Cloud application easier to build: Silverlight 3 as presentation tier, .NET RIA services as the business logic and data access tier, and Windows Azure Table as the data storage tier. The sample application in this article demonstrates the architecture with a simple Survey application with all these technologies working together from Windows Azure.

Rendering ASP.NET Script References into the Html Header

  
One thing that I've come to appreciate in control development in ASP.NET that use JavaScript is the ability to have more control over script and script include placement than ASP.NET provides natively. Specifically in ASP.NET you can use either the ClientScriptManager or ScriptManager to embed scripts and script references into pages via code.

Temporary tables in SQL Server vs. table variables

  
When writing T-SQL code, you often need a table in which to store data temporarily when it comes time to execute that code. You have four table options: normal tables, local temporary tables, global temporary tables and table variables. I'll discuss the differences between using temporary tables in SQL Server versus table variables.

Import XML File to SQL Table

  
Here is a brief example of importing an XML file into SQL Server table. This is accomplished by using the BULK option of OPENROWSET to load the file, and then utilizing the XQuery capabilities of SQL Server to parse the XML to normalized table format. This example requires SQL server 2005 or SQL Server 2008.

First, the following XML is saved to XML file C:\Products.xml.

Adding the table row below a particular row.

  

What is the best method in jQuery to add an additional row to a table as the row below a particular row?


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend