How T Create Relationship B/w Two Tables
Hi
I have two database as Malathi,Indoo
In Malathi database i have
Employee Table AS
----------------------
Eid Int (PK)
Enam varchar(50)
In Indoo Database I have
Job table as
Eid int (FK)
Jid Int (PK)
Now how can i create relation b/w two tables of different database
Any One can help for this query
Malathi Rao
View Complete Forum Thread with Replies
Related Forum Messages:
How To Create A Datagrid For Two No Relationship Tables
Hi, I am trying to create a create for two table A and table B which have no relationship each time. For TableA, there are 3 columns like ID, APoints1, APoint2. For Table B, there are also 3 columns as ID, Qty, BPoints. There is no internal relationship for these two tables. But there may be same ID inside A and B for some records. Now I want to create a datagrid for displaying the information as : ID, Sum(A.APoints1 + A.APoints2) - Sum(B.Qty * B.BPoints) WHERE A.ID = B.ID Please Notice that I can't use directly SQL script as following from table A and table B because there is no relationship for Table A and Table B, otherwise the recult set would be wrong: Select A.ID, Sum(A.APoints1 + A.APoints2) - Sum(B.Qty * B.BPoints) WHERE A.ID = B.ID group by A.ID May I know is there solution for it? Thank you very much!
View Replies !
Create Relationship With Tables In A Linked Server
I need to create a relationship between a local table and tables on alinked server. I used the design table wizard and selected therelationship property wizard. In the reslationship property wizard,the tables that I need to get the keys from in the linked server do notshow up. Is there a way to do this, or I simply don't have enoughpermission to tables in the linked server. On the local server, theSecurity tab of linked server property has Local Loging "sa", RemoteUser "sa" and Remote Password "****". Thanks for your help.
View Replies !
How Can I Create A One-to-one Relationship In A SQL Server Management Studio Express Relationship Diagram?
How can I create a one-to-one relationship in a SQL Server Management Studio Express Relationship diagram? For example: I have 2 tables, tbl1 and tbl2. tbl1 has the following columns: id {uniqueidentifier} as PK name {nvarchar(50)} tbl2 has the following columns: id {uniqueidentifier} as PK name {nvarchar(50)} tbl1_id {uniqueidentifier} as FK linked to tbl1.id If I drag and drop the tbl1.id column to tbl2 I end up with a one-to-many relationship. How do I create a one-to-one relationship instead? mradlmaier
View Replies !
Import Csv Data To Dbo.Tables Via CREATE TABLE && BUKL INSERT:How To Designate The Primary-Foreign Keys && Set Up Relationship?
Hi all, I use the following 3 sets of sql code in SQL Server Management Studio Express (SSMSE) to import the csv data/files to 3 dbo.Tables via CREATE TABLE & BUKL INSERT operations: -- ImportCSVprojects.sql -- USE ChemDatabase GO CREATE TABLE Projects ( ProjectID int, ProjectName nvarchar(25), LabName nvarchar(25) ); BULK INSERT dbo.Projects FROM 'c:myfileProjects.csv' WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '' ) GO ======================================= -- ImportCSVsamples.sql -- USE ChemDatabase GO CREATE TABLE Samples ( SampleID int, SampleName nvarchar(25), Matrix nvarchar(25), SampleType nvarchar(25), ChemGroup nvarchar(25), ProjectID int ); BULK INSERT dbo.Samples FROM 'c:myfileSamples.csv' WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '' ) GO ========================================= -- ImportCSVtestResult.sql -- USE ChemDatabase GO CREATE TABLE TestResults ( AnalyteID int, AnalyteName nvarchar(25), Result decimal(9,3), UnitForConc nvarchar(25), SampleID int ); BULK INSERT dbo.TestResults FROM 'c:myfileLabTests.csv' WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '' ) GO ======================================== The 3 csv files were successfully imported into the ChemDatabase of my SSMSE. 2 questions to ask: (1) How can I designate the Primary and Foreign Keys to these 3 dbo Tables? Should I do this "designate" thing after the 3 dbo Tables are done or during the "Importing" period? (2) How can I set up the relationships among these 3 dbo Tables? Please help and advise. Thanks in advance, Scott Chang
View Replies !
Trying To Create A Relationship
Here is the error I am getting'role' table saved successfully'users' table- Unable to create relationship 'FK_users_role'. ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]ALTER TABLE statement conflicted with COLUMN FOREIGN KEY constraint 'FK_users_role'. The conflict occurred in database 'raintranet', table 'role', column 'role_id'.table rolerole_id intname varchar 50table usersusers_id introle_id inTrying to get table.role_id to be related to role.role_idAny help would be appreciated
View Replies !
How To Create A Relationship?
How do I create a relationship between two tables when the two columns that should connect each table have different names? i.e. Table Person Column Name < -- > Table Employee Column Person Name The two columns actually contain the same data type but different field name and size. I know this involves a series of steps. What are they? Could you please include some sample code.
View Replies !
Best Way To Create The Relationship
Hi - SQL beginer here.... SQL2005 I have a table dbo.server Compid - 1 Name PK - Server1 Make - HP etc... I have just created a new table dbo.ProcessorInfo with the following columns: Name BrandName ProcessorCoreCount etc.... This table will have more than 1 record for each name: Server1 Intel 2 Server1 Intel 2 Server2 Intel 1 Server2 Intel 1 and so on. What is the best way to relate the name in dbo.server and name in dbo.ProcessorInfo so this is a one to many? Obviously I can't set the name column as a PK as I have more than 1 record of the same value in it. Help much appreciated!
View Replies !
How To Create A One-to-one Relationship
hello all, I am new to SQL server and dont have a clue on how to create a one-to-one relationship in sql server2000. Say, I have a table 'A' with a PK <customer_id> and another table 'B' with a PK <order_id>. Now to define a one-to-one relation between them how to do that? thanks in advance. -tanveer
View Replies !
Create Trigger For Relationship
Hi, I need help in creating a trigger before delete. The trigger should be in such a way that it should display a message, if there is any relationship with other table. For example I have a table with employee details which have empid as primary key. I have another table with employee salary details where empid is foreign key. The trigger should check the relationship with these two tables. If I try to delete an emploeyee from employee details table and if there is a relationship of that employee with the salary table then the trigger should print a message. If there is no relationship then the trigger should perform the deletion. I want to create a trigger like this. Please help!!!!!!!!!!!!!!!!
View Replies !
How Do I Create A Relationship In DB Diagrammer ?
Hi Folks, When I try to create a Relationship between two Tables I find the Relationship is always created from the Table I start with to itself. I seem to have to select a Table to enable the Create Relationship option, and then when I 'Add' it creates a recursive Relationship to that Table. I guess it must be possible to do what I am trying to do ? I'd appreciate any advice. Thanks. Barry
View Replies !
Create Table With Many-to-many Relationship...
Hi, I come back again. Can anyone help me to create table with many-to-many relationship. Here is my three tables tbl_Networks ( NID int identity(1,1) primary key, NetworkName nvarchar(256) ) tbl_Categories ( CID int identity(1,1) primary key, CateName nvarchar(256), NID int ) tbl_Sim ( SID int identity(1,1) primary key, NID int, CID int, NameOfSim nvarchar(256) ) My problem is 1 value in tbl_Sim may have multiple values in table tbl_Categories and vice versal. And I don't know how to organise them So I need some help...
View Replies !
Unable To Create Relationship FK
Hi. I get this error when i try to create a relationship in a db diagram (sql 2005) "'tblActivedir' table saved successfully 'tblClient' table - Unable to create relationship 'FK_tblClient_tblActivedir1'. Introducing FOREIGN KEY constraint 'FK_tblClient_tblActivedir1' on table 'tblClient' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints. Could not create constraint. See previous errors." What i have is 2 tables. 1 named client 1 named activedir In the client table the columns i want to bind with activedirtable are FR1 and DC1 I want to bind them in the ID of the activedir table (both, in different fk relationships) so that they get the id of activedir. Fr1 has an fk relationship with activedir (pk is activedir' id) and DC1 exactly the same in another fk. So i want both columns to comunicate with activedir. If p.e. activedir has 3 elements (a,b,c) when i delete element a then werever FR1 or DC1 have this element(binded to it's id) then the element will also be deleted (id of the element) from both FR1 and DC1 I don't want to set Delete and Update action to none because i want the element changed or deleted from activedir, to do the same on Fr1 or DC1 or both. Any help? Thanks.
View Replies !
Create Table With Recursive Relationship
I am fairly new to SQL and I am currently trying to createa SQL table (using Microsoft SQL) that has a recursiverelationship, let me try to explain:I have a piece of Data let's call it "Item" wich may again contain onemore "Items". Now how would I design a set of SQL Tables that arecapable of storing this information?I tried the following two approaches:1.) create a Table "Item" with Column "ItemID" as primary key, somecolums for the Data an Item can store and a Column "ParentItemID". Iset a foreign key for ParentItemID wich links to the primarykey"ItemID" of the same table.2.) create separate Table "Item_ParentItem" that storesItemID-ParentItemID-pairs. Each column has a foreign key linked toprimary key of the "Item" Column "ItemID".In both approaches when I try to delete an Item I get an Exceptionsaying that the DELETE command could not be executed because itviolates a COLUMN REFERENCE constraint. The goal behind these FK_PKrelations is is that when an Item gets deleted, all childItems shouldautomatically be deleted recursively.How is this "standard-problem" usually solved in sql? Or do I inned toimplement the recursive deletion myself using storedprocedures or something ?
View Replies !
Create A View For One-to-many Relationship Table
hi.. I would like to create a view for two tables which have a one-to-many relationship. Code: Table: Supplier Supp_ID 1 Table:Supplier_category Supp_ID,StockCategoryID 1,56 1,57 1,90 How can i create a view that has columns like below: Supp_ID, Stock 1,[56,57,90] Thanks in advance.
View Replies !
How To Use The Create Relationship Function At MS SQL Server
hi all, For those who will celebrate the chinese new year, Gong Xi Fa Cai!!! I now using microsoft SQL server to manage my database. To manage the database, I have go through the SQL Server Enterprise Manager To create my database. Now I am the stage create the relationship for my relations. So when I drag the foreign key from one relation to primary key at another relation, vice versa, it will pop up the 'Create Relationship' form. What I can saw is there are three check boxes. one check boxes have 2 sub check boxes. Quote: Checkbox 1 - [Check existing data on creation] Checkbox 2 - [Enforce relationship for replication] Checkbox 3 - [Enforce relationship for INSERTs and UPDATEs] Checkbox 3.1 - [Cascade Update Related Fields] Checkbox 3.2 - [Cascade Delete Related Records] Usually the Checkbox 1, 2, 3 had been checked. but the check box 3.1 and 3.2 is display as uncheck by default. Another question is when I linked up the relationship between two of the relations will appear a asterisk(*) beside the relation's name. Why? But I not very understand to the check boxes means and the asterisk. Can someone give me some guidelines!!Thanks Thanks in billions.... Best regards John Ang
View Replies !
Stored Procedue 2 Create A Relationship.
i have a table where the feilds are 1.fromtable 2.fromfeild 3.fromcategory 4.totable 5.tofeild 6.tocategory. i have write a stored proceduer for creating 2 relationship between fromfeild & tofeild from the same value in from category & in tocategory. there r around 465 records in a table. so anyone can comeout for solution of this. hope soon i get a solution for this.
View Replies !
Create Or Show Relationship Digram
Dear sir or madam I have a problem related to create or show relationship digram in sql server 2005. Especially, I want to show relationship diagram that I established in sqlserver 2000 in sql server 2005 but I can't and I don't how to do it. I look forward to hearing. Thank you in advance! Best regard, seyha moth
View Replies !
Relationship Of Tables Pls
:rolleyes: can u send me deails for establish relationship of tables i know namw of then but i need them by examples ans defination as 1 simple 2 complex 3 muliple u can send me ink if u get fron google also thanks bye
View Replies !
How Can I Update Relationship Tables?
<----------I have 2 tables are: 'customers (parent)' and 'open_ac (child)' <--------I have tried to insert and update data into sql database by using textboxes (don't use datagrid) <--------My tables details are below <-------this table uses for keeping user data customers fields: Column name type length Description cu_id int 4 Primary key Identifiers cu_fname nvarchar 20 allow null first name cu_lname nvarchar 40 allow null last name cu_nat nvarchar 20 allow null nationality cu_add nvarchar 40 allow null address cu_wplace nvarchar 40 allow null workplace cu_tel nvarchar 10 allow null telephone cu_fax nvarchar 10 allow null fax cu_email nvarchar 10 allow null email <----the open_ac uses for keeping register date/time of customers open_ac fields: Column name type length Description cu_id int 4 link key op_date date/time 8 register date <----------my code Imports System.Data.SqlClient Public Class cus_reg Inherits System.Web.UI.Page Dim DS As DataSet Dim iRec As Integer 'Current Record Dim m_Error As String = "" Public Property MyError() As String Get Return m_Error End Get Set(ByVal Value As String) m_Error = Value If Trim(Value) = "" Then Label3.Visible = False Else Label3.Text = Value Label3.Visible = True End If End Set End Property Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not Page.IsPostBack Then Dim C1 As New MISSQL 'DS = C1.GetDataset("select * from customers;select * from open_ac;select * from accounts") DS = C1.GetDataset("select * from customers;select * from open_ac") Session("data") = DS iRec = 0 Viewstate("iRec") = iRec Me.MyDataBind() Dim Dtr As DataRow = DS.Tables(0).NewRow DS.Tables(0).Rows.Add(Dtr) iRec = DS.Tables(0).Rows.Count - 1 viewstate("iRec") = iRec Me.Label2.Text = DateTime.Now Me.MyDataBind() Else DS = Session("data") iRec = ViewState("iRec") End If Me.MyError = "" End Sub Public Function BindField(ByVal FieldName As String) As String Dim DT As DataTable = DS.Tables(0) Return DT.Rows(iRec)(FieldName) & "" End Function Public Sub MyDataBind() Label1.Text = "Record : " & iRec + 1 & " of " & DS.Tables(0).Rows.Count txtcu_id.DataBind() txtcu_fname.DataBind() txtcu_lname.DataBind() txtcu_add.DataBind() txtcu_occ.DataBind() txtcu_wplace.DataBind() txtcu_nat.DataBind() txtcu_tel.DataBind() txtcu_fax.DataBind() txtcu_email.DataBind() End Sub Here is update code Private Sub bUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bUpdate.Click Dim DT As DataTable = DS.Tables(0) Dim DR As DataRow = DT.Rows(iRec) 'Dim DR1 As DataRow = DT1.Rows(iRec) If DR.RowState = DataRowState.Added Then If txtcu_id.Text.Trim = "" Then Me.MyError = "please enter your id" Exit Sub End If DR("cu_id") = txtcu_id.Text End If If txtcu_fname.Text.Trim = "" Then Me.MyError = "please enter your name" Exit Sub Else DR("cu_fname") = txtcu_fname.Text End If If txtcu_lname.Text.Trim = "" Then Me.MyError = "please enter your last name" Exit Sub Else DR("cu_lname") = txtcu_lname.Text End If If txtcu_add.Text.Trim = "" Then Me.MyError = "please enter your address" Exit Sub Else DR("cu_add") = txtcu_add.Text End If If txtcu_occ.Text.Trim = "" Then Me.MyError = "please enter your occupation" Exit Sub Else DR("cu_occ") = txtcu_occ.Text End If If txtcu_wplace.Text.Trim = "" Then Me.MyError = "please enter your workplace" Exit Sub Else DR("cu_wplace") = txtcu_wplace.Text End If If txtcu_nat.Text.Trim = "" Then Me.MyError = "Please enter your nationality" Exit Sub Else DR("cu_nat") = txtcu_nat.Text End If If txtcu_tel.Text.Trim = "" Then DR("cu_tel") = DBNull.Value Else DR("cu_tel") = txtcu_tel.Text End If If txtcu_tel.Text.Trim = "" Then DR("cu_fax") = DBNull.Value Else DR("cu_fax") = txtcu_fax.Text End If If txtcu_email.Text.Trim = "" Then DR("cu_email") = DBNull.Value Else DR("cu_email") = txtcu_email.Text End If Dim Strsql As String If DR.RowState = DataRowState.Added Then Strsql = "insert into customers (cu_id,cu_fname,cu_lname,cu_add,cu_occ,cu_wplace,cu_nat,cu_tel,cu_fax,cu_email) values (@P1,@P2,@P3,@P4,@P5,@P6,@P7,@P8,@P9,@P10)" Else Strsql = "update customers set cu_fname=@P2,cu_lname=@P3,cu_add=@P4,cu_occ=@P5,cu_wplace=@P6,cu_nat=@P7,cu_tel=@P8,cu_fax=@P9,cu_email=@P10 where cu_id =@P1" End If Dim C1 As New MISSQL Dim cmd As SqlCommand = C1.CreateCommand(Strsql) C1.CreateParam(cmd, "ITTTTTTTTT") cmd.Parameters("@P1").Value = DR("cu_id") cmd.Parameters("@P2").Value = DR("cu_fname") cmd.Parameters("@P3").Value = DR("cu_lname") cmd.Parameters("@P4").Value = DR("cu_add") cmd.Parameters("@P5").Value = DR("cu_occ") cmd.Parameters("@P6").Value = DR("cu_wplace") cmd.Parameters("@P7").Value = DR("cu_nat") cmd.Parameters("@P8").Value = DR("cu_tel") cmd.Parameters("@P9").Value = DR("cu_fax") cmd.Parameters("@P10").Value = DR("cu_email") Dim Y As Integer = C1.Execute(cmd) If Y > 0 Then DR.AcceptChanges() Else Me.MyError = "Can not register" End If <---------code above in this sub it can update only customers tables and when I tried to coding below<------------it alerts can not update Dim DT1 As DataTable = DS.Tables(1) Dim DR1 As DataRow = DT1.Rows(iRec) If DR1.RowState = DataRowState.Added Then If txtcu_id.Text.Trim = "" Then Me.MyError = "Please enter id" Exit Sub End If DR1("cu_id") = txtcu_id.Text End If If Label2.Text.Trim = "" Then DR1("op_date") = Label2.Text End If Dim StrSql1 As String If DR1.RowState = DataRowState.Deleted Then StrSql1 = "insert into open_ac (cu_id,op_date) values (@P13,@P14)" Else StrSql1 = "update open_ac set op_date=@P14 where cu_id=@P13" End If Dim C2 As New MISSQL Dim cmd2 As SqlCommand = C2.CreateCommand(StrSql1) C2.CreateParam(cmd2, "ID") cmd2.Parameters("@P1").Value = DR1("cu_id") cmd2.Parameters("@P2").Value = DR1("op_date") Dim Y1 As Integer = C2.Execute(cmd2) If Y1 > 0 Then DR1.AcceptChanges() Else Me.MyError = "Can not register" End If End Sub End Class <------this is class I use for connecting to database and call parameters.... MISSQL class Imports System.Data.SqlClient Public Class MISSQL Dim PV As String = "Server=web_proj;uid=sa;pwd=sqldb;" Dim m_Database As String = "c1_itc" Public Strcon As String Public Sub New() Strcon = PV & "database=" & m_Database End Sub Public Sub New(ByVal DBName As String) m_Database = DBName Strcon = PV & "database=" & m_Database End Sub Public Property Database() As String Get Return m_Database End Get Set(ByVal Value As String) m_Database = Value Strcon = PV & "database=" & m_Database End Set End Property Public Function GetDataset(ByVal Strsql As String, _ Optional ByVal DatasetName As String = "Dataset1", _ Optional ByVal TableName As String = "Table") As DataSet Dim DA As New SqlDataAdapter(Strsql, Strcon) Dim DS As New DataSet(DatasetName) Try DA.Fill(DS, TableName) Catch x1 As Exception Err.Raise(60002, , x1.Message) End Try Return DS End Function Public Function GetDataTable(ByVal Strsql As String, _ Optional ByVal TableName As String = "Table") As DataTable Dim DA As New SqlDataAdapter(Strsql, Strcon) Dim DT As New DataTable(TableName) Try DA.Fill(DT) Catch x1 As Exception Err.Raise(60002, , x1.Message) End Try Return DT End Function Public Function CreateCommand(ByVal Strsql As String) As SqlCommand Dim cmd As New SqlCommand(Strsql) Return cmd End Function Public Function Execute(ByVal Strsql As String) As Integer Dim cmd As New SqlCommand(Strsql) Dim X As Integer = Me.Execute(cmd) Return X End Function Public Function Execute(ByRef Cmd As SqlCommand) As Integer Dim Cn As New SqlConnection(Strcon) Cmd.Connection = Cn Dim X As Integer Try Cn.Open() X = Cmd.ExecuteNonQuery() Catch X = -1 Finally Cn.Close() End Try Return X End Function Public Sub CreateParam(ByRef Cmd As SqlCommand, ByVal StrType As String) 'T:Text, M:Memo, Y:Currency, D:Datetime, I:Integer, S:Single, B:Boolean, P: Picture Dim i As Integer Dim j As String For i = 1 To Len(StrType) j = UCase(Mid(StrType, i, 1)) Dim P1 As New SqlParameter P1.ParameterName = "@P" & i Select Case j Case "T" P1.SqlDbType = SqlDbType.NVarChar Case "M" P1.SqlDbType = SqlDbType.Text Case "Y" P1.SqlDbType = SqlDbType.Money Case "D" P1.SqlDbType = SqlDbType.DateTime Case "I" P1.SqlDbType = SqlDbType.Int Case "S" P1.SqlDbType = SqlDbType.Decimal Case "B" P1.SqlDbType = SqlDbType.Bit Case "P" P1.SqlDbType = SqlDbType.Image End Select Cmd.Parameters.Add(P1) Next End Sub End Class <-------Thank you in advance<-------and Thank you very much for all help
View Replies !
Establish Relationship Between 2 Tables
I am running SQL Server CE on Visual Studio 2005. I have created 2 tables and wish to establish a relationship between the two tables. However, I could not find a proper way to establish the connection. Anyone can provide some help on this? thank you.
View Replies !
Combing Two Tables With No Relationship
Which way to go? Have two separate programs(Visual Studio-Coded in Visual Basic) that share the same sql 2005 database(called Night Audit) The tables are called RoomSettlement and Settlement. They were separate tables and separate programs in the past because it was just exported in excel to a visual integrator that dumped the amounts into our accounting software. Now needing to combine the two tables(that have no link) on to a single excel sheet daily where the tables have the same date: Table: Room Settlement – Field: RoomSettlementDatetxt = Table: Settlement – Field: SettlementDatetxt Any Ideas on the best way to go? (Link the tables with a foreign key and primary key, maybe union based on date, or any easier suggestion with out having to change a lot of the program ) Room Settlement Table PrimaryKey Availabilitytxt Ratetxt Othertxt Arrivalstxt departurestxt GuestCounttxt HotelOccupancytxt AverageDailyRatetxt RevPahrtxt HotelRevenuetxt ownerrentaltxt hoteltransienttxt hotelcorptxt hotelgovtxt hotelpacktxt hotelexpediatxt hotelsynxistxt hotelothertxt rentalpooltxt employeetxt Hotelnightstxt activitestxt Bonustxt Golftxt Tvinternettxt laundrytxt misctxt petstaytxt Telephonetxt Purchaseunittxt Damageincometxt resalerevtxt latefeestxt IntrestIncometxt Taxestxt RoomSettlementDatetxt sitetxt senddatetxt Settlement Table: PrimaryKeyintUn PreviousGuesttxt TransferCityLedgertxt ActivityGuesttxt transferfromadvdepositguesttxt transfromguesttoguesttxt GuestchagefromInctxt Guestnetcashtxt Guestcheckstxt guestpaidout guestlockboxtxt guestaetxt GuestDinerstxt GuestDiscovertxt GuestMastercardtxt GuestVisatxt guestdepositchangecashtxt guestnetchangetxt guestnewbalancetxt guestsystembalancetxt guestvariance PreviousCity ActivityCitytxt Citynetcash Citychecks citypaidouttxt citylockboxtxt cityaetxt CityDinerstxt CityDiscovertxt CityMastercardtxt CityVisatxt citydepositchangecashtxt citynetchangetxt citynewbalancetxt citysystembalancetxt cityvariance Sitetxt DateStamptxt SettlementDatetxt Thanks JK
View Replies !
Help With INSERT Multiple Tables In Many-to-many Relationship?
I am relatively new to MS SQL (not a novice, but hardly a master). I am working on a content management application for a magazine publisher. It’s written in ASP (VB Script) and being created on Dreamweaver 8 with an MS SQL 2000 database. Now, I’m trying to decide the best and fastest approach to coding a complex INSERT and UPDATE function. My question isn’t as much about the SQL (although that will probably come up after I decide how to do this), but about the procedural steps and approach I shuold be taking to do this. Reporters will use an online form to enter their story into the system. It collects the usual data: Headline, byline, story content, and the story category (feature, opinion, entertainment, business, sports, etc.). Each story may belong to MULTIPLE categories (feature & business, for example). So, I’ve created three tables to support this many-to-many realtionship: Story Category StoryCat (a junction table with the IDs from both the other tables). The online form has a dropdown menu which pulls the available categories from the Categories table. When the reporter has entered the data I use ASP to performs the insert just as you would expect it to. The next step needs to be to update the StoryCat table so that it creates a new record with the StoryID of the record it just inserted, along with the CategoryID that was in that record. ------------------ As I said, I’m not sure of the best way to do this. Should I just pull back the last record inserted and then create a procedure that would insert into the StoryCat table (which is what I’m thinking of doing on the confirmation page), or is there another approach I should take (perhaps some sort of temporary table or stored procedure?). Any and all help will be greatly appreciated.
View Replies !
Page 3 - Multiple Tables Without Relationship
Inner join vs outer join: Inner join will remove rows from the first table if there is not a corresponding row in the 2nd table. Outer join will keep the rows, and use all NULL values to fill in the gaps in the 2nd table. In general outer joins are more likely to grow a result set and inner joins are more likely to shrink one (though that will depend on the data and the query). For this reason, it is usually better when building complex queries to try to do your inner joins before your outer joins, because then you will keep your result set smaller for longer and thus the later joins can run faster.
View Replies !
Relationship Between Inserted And Deleted Tables?
Hi all, I just ran across an issue on a SQL 2000 sp4 db where RI was being maintained solely with triggers. I am attempting to change the primary key of a parent table and cascade the results to all its children without using the vendor-supplied trigger code (long story...) using an INSTEAD OF trigger. My question is: does SQL Server create any kind of relationship between the inserted and deleted tables that I could exploit since the key field is unavailable? I am trying to avoid having to add a surrogate key to each of the children just for this activity (as there are many M rows in each and no other suitable unique column combinations that span all the child tables). -DC
View Replies !
Index & FK Relationship On LookUp Tables
Hi! It's been always said that it is best to put index on commonly joined fields in the table. But putting too much index on the table would cause the table to be slow on insert and update. My question is, how do you deal with your fields that uses look up tables? Like for example for these fields - CountryID(smallint) - CreatedBy(int) - ModifiedBy(int) - Status(tinyint) Those fields don't come a big part in the table, though when I query the table I always join them with their respective primary table to get their respective text value. Do I still need to put Index & FK relationships to these fields? What fields are normally good candidates for index or fk relationships? Thanks, Enzo
View Replies !
Failing To Create Relationship (SQL Server Claims Table Lacks PK For Some Reason ?)
I tried to create a relationship in EM's diagram pane inSQL Server 2000 (I'd list the version of EM, but About gives methe MMC version, which is probably not relevant.)(The database itself is SQL Server 2000 SP3.)I got an error that I don't understand (because, at leastat first blush, it appears to be quite untrue). Note thatI have never clicked before on the diagrams child of thedatabase; this was entirely experimental."Primary key or UNIQUE constraint must be defined fortable 'xxx' before it can participate in a relationship."http://msdn.microsoft.com/library/d...cantbepktbl.asp1) My table already had a primary key; why is MS SQL Server apparentlyclaiming otherwise ? (I don't think I can define a second primary keyon the same table. I could perhaps define an additional unique indexon top of the primary key, but, I'm not sure.)2) What does it mean: table '<0s>' ? That is, what does 0s mean ?
View Replies !
Failing To Make Relationship Between To Tables Of SQL Server DB
Hi, I'm trying to make relationship between two tables "reservation" and "charges". The column is "booking_ticket". Its giving me following error : 'reservations (akr)' table saved successfully 'charges (akr)' table - Unable to create relationship 'FK_charges_reservations'. ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]ALTER TABLE statement conflicted with COLUMN FOREIGN KEY constraint 'FK_charges_reservations'. The conflict occurred in database 'limp', table 'reservations', column 'booking_ticket'. I used to make relationship before , but never found this problem. Kindly guide me to solve it. Regards,
View Replies !
SSIS And Parent-Child Relationship Tables
Supose I have two records in a parent-child relationsuip (actually I have many more such records). Does SSIS offer any support ask for inserting one record into the parent table, the other into the child table, and updating the foreign key of the child to point to the parent? TIA, Barkingdog P.S. I have to do just this as part of the datawarehouse test I'm running. Seems like a common task but I don't recall anything in SSIS addressing the issue.
View Replies !
Code A Function To Return A Dataset In Which There Are Two Tables And Relationship
I used a function to create dataset as below: Public Function GetSQLDataSet(ByVal SQL As String) As DataSet ...... MyConnection = New SqlConnection(MyConnectionString) MyCommand = New SqlCommand(SQL, MyConnection) MyDataSet = New DataSet MySQLDataAdapter = New SqlDataAdapter(MyCommand) MySQLDataAdapter.Fill(MyDataSet) ...... End function It works fine. How to code a function to return a dataset in which there are two tables and relationship?
View Replies !
Retrieving The Tables Relationship From SQL Server Database Diagrams
Hi All, Currently i am defining a simple relationship between Customers->Orders->Order Details through the Database Diagrams feature in the SQL 2K. Using the Server Explorer, i can see the Database Diagrams, but when i try to "drop" the Database Diagrams into the page, it gives the error message. I would like to know the procedures to retrieve the database relationships from Database Diagrams and manipulate them through ADO.NET I prefer to "convert" already defined relationship using SQL Server Database Diagrams into XSD file or probably there is another method to "read" those relationship and manipulate them. Thank you very much for all your help
View Replies !
Inserting Data Into Two Tables With Parent-child Relationship
I am trying to insert data into two tables with a SSIS package. One table has a foreign key relationship to the other table's primary key. When I try to run the package, the package will just seems to hang up in bids. I have found two ways around the issue but I don't like either approach. Is there a way to set which table gets insert first? If I uncheck the check constraints option on the child table, the package will run very quickly but this option alters the child table and basically disables the constraint. I don't like this option because it is altering the database. The second approach is to set the commit level on both tables to say 10,000 and make sure that the multicast component has the first output path moved to the parent table. I don't like this option because I am not sure if the records are backed out if the package should abend after records have been committed.
View Replies !
Solution!-Create Access/Jet DB, Tables, Delete Tables, Compact Database
From Newbie to Newbie, Add reference to: 'Microsoft ActiveX Data Objects 2.8 Library 'Microsoft ADO Ext.2.8 for DDL and Security 'Microsoft Jet and Replication Objects 2.6 Library -------------------------------------------------------- Imports System.IO Imports System.IO.File Code Snippet 'BACKUP DATABASE Public Shared Sub Restart() End Sub 'You have to have a BackUps folder included into your release! Private Sub BackUpDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackUpDB.Click Dim addtimestamp As String Dim f As String Dim z As String Dim g As String Dim Dialogbox1 As New Backupinfo addtimestamp = Format(Now(), "_MMddyy_HHmm") z = "C:Program FilesVSoftAppMissNewAppDB.mdb" g = addtimestamp + ".mdb" 'Add timestamp and .mdb endging to NewAppDB f = "C:Program FilesVSoftAppMissBackUpsNewAppDB" & g & "" Try File.Copy(z, f) Catch ex As System.Exception System.Windows.Forms.MessageBox.Show(ex.Message) End Try MsgBox("Backup completed succesfully.") If Dialogbox1.ShowDialog = Windows.Forms.DialogResult.OK Then End If End Sub Code Snippet 'RESTORE DATABASE Private Sub RestoreDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RestoreDB.Click Dim Filename As String Dim Restart1 As New RestoreRestart Dim overwrite As Boolean overwrite = True Dim xi As String With OpenFileDialog1 .Filter = "Database files (*.mdb)|*.mdb|" & "All files|*.*" If .ShowDialog() = Windows.Forms.DialogResult.OK Then Filename = .FileName 'Strips restored database from the timestamp xi = "C:Program FilesVSoftAppMissNewAppDB.mdb" File.Copy(Filename, xi, overwrite) End If End With 'Notify user MsgBox("Data restored successfully") Restart() If Restart1.ShowDialog = Windows.Forms.DialogResult.OK Then Application.Restart() End If End Sub Code Snippet 'CREATE NEW DATABASE Private Sub CreateNewDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateNewDB.Click Dim L As New DatabaseEraseWarning Dim Cat As ADOX.Catalog Cat = New ADOX.Catalog Dim Restart2 As New NewDBRestart If File.Exists("C:Program FilesVSoftAppMissNewAppDB.mdb") Then If L.ShowDialog() = Windows.Forms.DialogResult.Cancel Then Exit Sub Else File.Delete("C:Program FilesVSoftAppMissNewAppDB.mdb") End If End If Cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Program FilesVSoftAppMissNewAppDB.mdb; Jet OLEDB:Engine Type=5") Dim Cn As ADODB.Connection 'Dim Cat As ADOX.Catalog Dim Tablename As ADOX.Table 'Taylor these according to your need - add so many column as you need. Dim col As ADOX.Column = New ADOX.Column Dim col1 As ADOX.Column = New ADOX.Column Dim col2 As ADOX.Column = New ADOX.Column Dim col3 As ADOX.Column = New ADOX.Column Dim col4 As ADOX.Column = New ADOX.Column Dim col5 As ADOX.Column = New ADOX.Column Dim col6 As ADOX.Column = New ADOX.Column Dim col7 As ADOX.Column = New ADOX.Column Dim col8 As ADOX.Column = New ADOX.Column Cn = New ADODB.Connection Cat = New ADOX.Catalog Tablename = New ADOX.Table 'Open the connection Cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Program FilesVSoftAppMissNewAppDB.mdb;Jet OLEDB:Engine Type=5") 'Open the Catalog Cat.ActiveConnection = Cn 'Create the table (you can name it anyway you want) Tablename.Name = "Table1" 'Taylor according to your need - add so many column as you need. Watch for the DataType! col.Name = "ID" col.Type = ADOX.DataTypeEnum.adInteger col1.Name = "MA" col1.Type = ADOX.DataTypeEnum.adInteger col1.Attributes = ADOX.ColumnAttributesEnum.adColNullable col2.Name = "FName" col2.Type = ADOX.DataTypeEnum.adVarWChar col2.Attributes = ADOX.ColumnAttributesEnum.adColNullable col3.Name = "LName" col3.Type = ADOX.DataTypeEnum.adVarWChar col3.Attributes = ADOX.ColumnAttributesEnum.adColNullable col4.Name = "DOB" col4.Type = ADOX.DataTypeEnum.adDate col4.Attributes = ADOX.ColumnAttributesEnum.adColNullable col5.Name = "Gender" col5.Type = ADOX.DataTypeEnum.adVarWChar col5.Attributes = ADOX.ColumnAttributesEnum.adColNullable col6.Name = "Phone1" col6.Type = ADOX.DataTypeEnum.adVarWChar col6.Attributes = ADOX.ColumnAttributesEnum.adColNullable col7.Name = "Phone2" col7.Type = ADOX.DataTypeEnum.adVarWChar col7.Attributes = ADOX.ColumnAttributesEnum.adColNullable col8.Name = "Notes" col8.Type = ADOX.DataTypeEnum.adVarWChar col8.Attributes = ADOX.ColumnAttributesEnum.adColNullable Tablename.Keys.Append("PrimaryKey", ADOX.KeyTypeEnum.adKeyPrimary, "ID") 'You have to append all your columns you have created above Tablename.Columns.Append(col) Tablename.Columns.Append(col1) Tablename.Columns.Append(col2) Tablename.Columns.Append(col3) Tablename.Columns.Append(col4) Tablename.Columns.Append(col5) Tablename.Columns.Append(col6) Tablename.Columns.Append(col7) Tablename.Columns.Append(col8) 'Append the newly created table to the Tables Collection Cat.Tables.Append(Tablename) 'User notification ) MsgBox("A new empty database was created successfully") 'clean up objects Tablename = Nothing Cat = Nothing Cn.Close() Cn = Nothing 'Restart application If Restart2.ShowDialog() = Windows.Forms.DialogResult.OK Then Application.Restart() End If End Sub Code Snippet 'COMPACT DATABASE Private Sub CompactDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CompactDB.Click Dim JRO As JRO.JetEngine JRO = New JRO.JetEngine 'The first source is the original, the second is the compacted database under an other name. JRO.CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Program FilesVSoftAppMissNewAppDB.mdb; Jet OLEDB:Engine Type=5", "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:Program FilesVSoftAppMissNewAppDBComp.mdb; JetOLEDB:Engine Type=5") 'Original (not compacted database is deleted) File.Delete("C:Program FilesVSoftAppMissNewAppDB.mdb") 'Compacted database is renamed to the original databas's neme. Rename("C:Program FilesVSoftAppMissNewAppDBComp.mdb", "C:Program FilesVSoftAppMissNewAppDB.mdb") 'User notification MsgBox("The database was compacted successfully") End Sub End Class
View Replies !
Why I Got The Message As You Need To Create The Many-to-one Relationship Between The Case Table And The Nested Table?
Hi, all experts here, Thank you very much for your kind attention. I am trying to create a new mining structure with case table and nested table, the case table (fact table) has alread defined the relationships with the nested table(dimension table), and I can see their relationship from the data source view. But why the wizard for creating the new mining structure showed that message? Why is that? And what could I try to fix it? Hope it is clear for your help. Thanks a lot for your kind advices and I am looking forward to hearing from you shortly. With best regards, Yours sincerely,
View Replies !
How To Create Multiple Tables On The Fly So That Every User Each Has His/her Own Set Of Tables?
Hello all, Being still a relative newcomer to SQL Server (people may say I'm trying to take on too much being somewhat inexperienced once they read about the problem I'm trying to tackle, but alas...) I'm running into the following problem: I need to create tables in my user database on the fly (using Stored Procedures) so that each table can be created many times in the database but only once for every user. The tables should be named something like "username.Table1", "username.Table2" etc. as opposed to "dbo.Table1". I then want to use the stored procedure from .NET/C# in my web application, so that i can create the complete set of usertables for each of my clients. Now, I tackled the stored procedure part (that is, it creates all the tables I need with all the parameters I want) and am able to use it from my web application (which took some time to learn but proved quite easy to do), but I cannot seem to get it coupled to the current user (instead of the dbo). Every time I trie, the tables are created as dbo.Table1 and when I try to create a new set, it gives a warning ("table with name such and so already exists..."). I made sure to log in as an authenticated user (using forms authentication) before trying to create the tables but this gives the aforementioned result. What am I doing wrong? I use Visual Web Developer Express, SQL Server 2005 Express and IIS version 5.1 Please help :-D Greetingz, DJ Roelfsema
View Replies !
Cannot INSERT Data To 3 Tables Linked With Relationship (INSERT Statement Conflicted With The FOREIGN KEY Constraint Error)
Hello I have a problem with setting relations properly when inserting data using adonet. Already have searched for a solutions, still not finding a mistake... Here's the sql management studio diagram : and here goes the code1 DataSet ds = new DataSet(); 2 3 SqlDataAdapter myCommand1 = new SqlDataAdapter("select * from SurveyTemplate", myConnection); 4 SqlCommandBuilder cb = new SqlCommandBuilder(myCommand1); 5 myCommand1.FillSchema(ds, SchemaType.Source); 6 DataTable pTable = ds.Tables["Table"]; 7 pTable.TableName = "SurveyTemplate"; 8 myCommand1.InsertCommand = cb.GetInsertCommand(); 9 myCommand1.InsertCommand.Connection = myConnection; 10 11 SqlDataAdapter myCommand2 = new SqlDataAdapter("select * from Question", myConnection); 12 cb = new SqlCommandBuilder(myCommand2); 13 myCommand2.FillSchema(ds, SchemaType.Source); 14 pTable = ds.Tables["Table"]; 15 pTable.TableName = "Question"; 16 myCommand2.InsertCommand = cb.GetInsertCommand(); 17 myCommand2.InsertCommand.Connection = myConnection; 18 19 SqlDataAdapter myCommand3 = new SqlDataAdapter("select * from Possible_Answer", myConnection); 20 cb = new SqlCommandBuilder(myCommand3); 21 myCommand3.FillSchema(ds, SchemaType.Source); 22 pTable = ds.Tables["Table"]; 23 pTable.TableName = "Possible_Answer"; 24 myCommand3.InsertCommand = cb.GetInsertCommand(); 25 myCommand3.InsertCommand.Connection = myConnection; 26 27 ds.Relations.Add(new DataRelation("FK_Question_SurveyTemplate", ds.Tables["SurveyTemplate"].Columns["id"], ds.Tables["Question"].Columns["surveyTemplateID"])); 28 ds.Relations.Add(new DataRelation("FK_Possible_Answer_Question", ds.Tables["Question"].Columns["id"], ds.Tables["Possible_Answer"].Columns["questionID"])); 29 30 DataRow dr = ds.Tables["SurveyTemplate"].NewRow(); 31 dr["name"] = o[0]; 32 dr["description"] = o[1]; 33 dr["active"] = 1; 34 ds.Tables["SurveyTemplate"].Rows.Add(dr); 35 36 DataRow dr1 = ds.Tables["Question"].NewRow(); 37 dr1["questionIndex"] = 1; 38 dr1["questionContent"] = "q1"; 39 dr1.SetParentRow(dr); 40 ds.Tables["Question"].Rows.Add(dr1); 41 42 DataRow dr2 = ds.Tables["Possible_Answer"].NewRow(); 43 dr2["answerIndex"] = 1; 44 dr2["answerContent"] = "a11"; 45 dr2.SetParentRow(dr1); 46 ds.Tables["Possible_Answer"].Rows.Add(dr2); 47 48 dr1 = ds.Tables["Question"].NewRow(); 49 dr1["questionIndex"] = 2; 50 dr1["questionContent"] = "q2"; 51 dr1.SetParentRow(dr); 52 ds.Tables["Question"].Rows.Add(dr1); 53 54 dr2 = ds.Tables["Possible_Answer"].NewRow(); 55 dr2["answerIndex"] = 1; 56 dr2["answerContent"] = "a21"; 57 dr2.SetParentRow(dr1); 58 ds.Tables["Possible_Answer"].Rows.Add(dr2); 59 60 dr2 = ds.Tables["Possible_Answer"].NewRow(); 61 dr2["answerIndex"] = 2; 62 dr2["answerContent"] = "a22"; 63 dr2.SetParentRow(dr1); 64 ds.Tables["Possible_Answer"].Rows.Add(dr2); 65 66 myCommand1.Update(ds,"SurveyTemplate"); 67 myCommand2.Update(ds, "Question"); 68 myCommand3.Update(ds, "Possible_Answer"); 69 ds.AcceptChanges(); 70 and that causes (at line 67):"The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Question_SurveyTemplate". The conflict occurred in database "ankietyzacja", table "dbo.SurveyTemplate", column 'id'. The statement has been terminated. at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping) at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping) at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable) at AnkietyzacjaWebService.Service1.createSurveyTemplate(Object[] o) in J:\PL\PAI\AnkietyzacjaWebService\AnkietyzacjaWebServicece\Service1.asmx.cs:line 397" Could You please tell me what am I missing here ? Thanks a lot.
View Replies !
A &"Dynamic&" Relationship Between Multiple Tables
Hello all. I'm hoping someone can help me with this problem.I have a lot of experience with sql server and as the years have progressed, I have gotten much picker about my relational design. I enforce referential integrity whenever possible. However, I'm running into a pattern in my current project that seems to defy referential integrity, or at the least, cause me to have to write a lot of extra code to allow sql server to enforce it.For example, I have a comments table:-------------------------------------CommentID int identity (the pk)UserID int (ID of the user who made the comments)DateCreated smalldatetime (date it was created)CommentsText ntext (the comments)-------------------------------------This is all fine and good, except I need to relate this table to a multitude of other tables. If I enforce RI, I have to make a seperate column for each entity the Comments table might be related to, and allow that column to be null. For example, my Comments may be related to tables such as Project, Contract, Ammendment, FundingRequest, and many others. So my Comments table gets "cluttered" with a bunch of nullable foreign keys:------------------------------------ProjectID int nullContractID int nullAmendmentID int nullFundingRequestID int nulletc...-------------------------------------this requires adding code every time a create a new entity that needs comments related to it. Alternatively, I could make seperate junction tables for each relationship, such as a ProjectToComment table with commentID, projectID and so on for each table, but that seems worse.A guy here suggested that I turn off RI for these relationships to my comments table, and give it a CommentTypeID which related to a CommentType table with ID/Name columns. The CommentType table would hold what I'm related the comments to: Project, Contract, etc. Then the Comment table would also have GenericID column, which would be a foreign key to either the project, contract, ammendment, etc. tables. I would have to turn off RI, but could enforce a semblence of RI using a trigger, which would check the CommentTypeID, then check one of the tables the comments could be related to make sure the foreign key exists in one of the parent tables. So my final schema would look like this:-------------------------------------COMMENTCommentID int identity (the pk)UserID int (ID of the user who made the comments)DateCreated smalldatetime (date it was created)CommentsText ntext (the comments)CommentTypeID int not null (the entity type it is related to: Contract, Project, Amendment, etc.)GenericID int not null (an FK to one of the above tables, based upon the CommentTypeID)--------------------------------------------------------------------------COMMENTTYPECommentTypeID int not null identity (the PK)CommentTypeName nvarchar(50) (the name of the table i represent: Project, Contract, Amendment, etc.)-------------------------------------This sounds like a clean solution that requires a lot less code, still keeps data from getting corrupt and allows approriate queries and reporting. It seems to violate Referential Integrity in a sense. I'm basically genericizing certain relationships for my own sanity.Is there another option that I'm missing here? I must add that I'm seeing this issue repeatedly in my code, where a single table might be related to many other tables that may or may not be related to each other.Thanks,Fregas
View Replies !
How To Basically Copy Tables With New Names Rather Than Create Similar Tables From Similar Manual Input.
I have a table that I am basically reduplicating a couple of times for each part of this database that I want to create.Each table basically has the same data: The tables will be called motherTable, fatherTable, sonTable, daughterTable and so on.I am pretty much using the following in each column: UserID, MotherID(or FatherID or SonID, etc., etc. and so on for each unique table), FirstName, LastName, MiddleName, BirthPlace, Photo, Age.I don't see an option to copy a table and just modify the second ID part and rename that table accordingly.How can I make this an easier way of creating these similar tables without retyping all these columns over and over again?Thanks in advance.
View Replies !
How To Create Tables?
Hi All, I am a serious NT sql NEWBIE. I have installed v7 on my NT/MIIS. I want to allow another party now to create tables on their SQL db they have runnning on my server (their own domain) What is the best way -? Do they send me the scripts or is there a way to run them remotely and create them. If they do send me the scripts what do I do? Regards Amy
View Replies !
How To Create Such Tables??
hello all... i want to drop table 2Autonumber ---- table name but when i run query i am getting following error drop table 2Autonumber Error : Server: Msg 170, Level 15, State 1, Line 1 Line 1: Incorrect syntax near '2'. also know how to create such tables?? T.I.A Papillon
View Replies !
Create Tables With Other Different Prefixes
I was just looking at the AdventureWorks Database Sample and I see the Tables and the Procedures have different prefixes other than dbo. How can I create Tables that use different prefixes as I would like to organize my tables better. Thanks in advance.
View Replies !
Create Tables Dynamically
Hi! I am using VS 2003 (v 1.1) I need to generate tables with the values from the Backend (SQLServer 2000) database in C#.Net. How can i create the tables, tablerows, cells, etc. from the codebehind page of C#. I am having a very little knowledge about dynamic generation. Give me the complete code with can example (if possible) Thanks & Regrads Jai Shankar
View Replies !
How To Create 3 Users Tables?
Hello,In my web site I have 2 types of users: students and professors.All users need to login but the personal information for each user type has different fields.So I create 3 tables: professors, students and authentication,"professors" will have all the personal data from professors."students" will have all the personal data from students.authentication will have the username and password from all users.How can i link authentication table to both professors and students tables so when the user logins i get the data from that user, either a professor or student?And is the right way to do this?I am using SQL 2005 and Asp.Net 2.0Thanks,Miguel
View Replies !
|