Table Linking Discussion
Jan 15, 2004
I would like to hear your thoughts on a philosophy I adhere to.
As a rule of thumb I've always preached that Unique Indexes are for linking tables and Primary Keys are used to ensure that records aren't duplicated. I’ve embraced this philosophy for a couple reasons, the main one being that I don’t have to create numerous foreign key fields in the foreign key table.
However I’ve done most of my programming in Access and am now in need of something more robust (SQL Server v7) and I’m wondering if I need to reconsider.
I do also have a how to question; that being is it possible to create a table join on a unique index in SQL Server v7 and if so how? I would like to have an Auto Number / Auto Incremented / Unique Identifier field in the Primary Key table that links to a numeric field in the Foreign Key table.
Thanks in advance
Dog
View 14 Replies
ADVERTISEMENT
Sep 29, 2014
i have 6 table in SQL Server and i have created one view and create single table by linking all the table,now i want to join two column like
Column A and Column B = Column C
e.g
A B C
Atul Jadhav Atuljadhav
Vijay vijayvijay
in above exambe column A having firstName and Column B having second name and i want to join this two column in C column "atuljadhav" and if column B is blank then it join A value tow timestriger code as it is auto update column and every time (update, append, modify, delete) it should be update automatic
View 5 Replies
View Related
Jan 3, 2008
I have several pdf files that need to be imported into the database. Each pdf file is to link to several rows in a database.
The files have different file names and keep coming every week. I need to import them into a table and link it with the data table. Need help on how to get the filename out of the pdf file and save it on the table with the image. I can use that filename as the foriegn key..Any help would be really great..
-Sri
View 2 Replies
View Related
Nov 10, 2005
Little puzzle this.I need to link from SQL2000 to Access to get to a table held within anAccess DB. Now you can link within Access to a SQL table, but can thisbe done the other way round ? It's the first time I've needed to dosomething like this.What I have is an application which was written (by me) with an Accessbackend (to run on a CD) and now it needs to run on SQL. However, Iwant to be able to swap over between backends so that I can choosewhere this runs from. I've done this with the sole exception of onetable. Previously most of the data was held in one MDB file and a linkto another (one local copy and one on CD). My queries use the link toquery both local and the CD copy data together.I can re-write things if I need to, but I was curious about there beinga way of doing this. What I want in effect is to query a view on SQL,but the data will be held in Access instead of on SQL.I suppose I can import as I need it as the data is purely read only. Idon't think this can be done, but wanted to check first. I can alwaysmove the remainder of the data over to SQL if needed. It's not a bigproblem, just something I'm curious about.Any pointers would be appreciated.Thanks in advanceRyanp.s. In case anyone wonders why I have taken this approach it isbecause we have a query tool and data that we send out to clients onCD. Some now want this web based, so I will publish the application ona Citrix server, and by changing a config file can swap within theapplication to point to SQL (by changing the ODBC settings). This way,I only need one copy of the application and can change backends as Ineed to.
View 2 Replies
View Related
Aug 12, 2007
Can someone help me with how I should set the relationship in my address tables and how they will affect the deleting of a client?
So, if I have:
tblClients ClientID
tblClientAddresses AddressID
tblClientAddressLinks AddressID, ClientID
Currently I have them set as a 1-M from tblClients to tblClientAddressLinks and a 1-M from tblClientAddresses to tblClientAddressLinks
If I try and delete a client and there address is shared wont this go very wrong?
So here is what happens when I try and delete a client:
The DELETE statement conflicted with the REFERENCE constraint "FK_tblClientAddressLinks_tblClients". The conflict occurred in database "DBSQL2", table "dbo.tblcLIENTAddressLinks", column 'clientID'.The statement has been terminated.
Here is what happens when I try and delete an address:
The DELETE statement conflicted with the REFERENCE constraint "FK_tblClientAddressLinks_tblClientAddresses". The conflict occurred in database "DBSQL2", table "dbo.tblClientAddressLinks", column 'Address_ID'.The statement has been terminated.
View 3 Replies
View Related
May 11, 1999
I am trying to link a table from a MS SQL database into access97 thru ODBC. When I do this, I get the message "Can't define field more than once." When I look at the table in SQL, there are no duplicate field names, however, when I bring the table in to do a Crystal Report, I see there are 2 fields that have duplicate field names 6 times. (Evidently Crystal doesn't care about this as Access does.) Any clues on what is happening?
View 2 Replies
View Related
Apr 3, 2006
Rather than using the upsize wizard in MS Access to connect to tables on a backend SQL server, how would I go about linking an Access Database to an existing table on an SQL server?
Thanks, Phil
View 11 Replies
View Related
Jan 11, 2000
I would like to create a MSAccess97 front end for some SQL7 data.
I created an odbc source system dsn for the server holding the SQL7 data.
When I try to add a table to my Access97 database by linking it to a SQL7 table, the only choices presented me are tables in the default database for SQL7 on my server. How do I link to tables in another database on that server? Thanks.
View 1 Replies
View Related
Sep 28, 1998
I`m trying out SQLServer7, have installed it on my workstation, have been able to open access97 and link to sql7 tables I created. Want another user to use access97 to set up her own database and link to my sql7 tables. Do I need to install anything from the sql7 beta disk on her desktop? Right now she can`t link a sql7 table to her access97 db. Thanks.
View 1 Replies
View Related
Aug 30, 2006
I'm having problems seeing the correct data type when linking my Access tables to MS SQL Server 2005. My varchar(max) fields are showing as text(255). I'm using the SQL Native Client.Has anyone else ssen this issue?
View 3 Replies
View Related
Dec 30, 2005
Hi,
Something strange has happened to my table. I used Enterprise Manager today to delete 3 columns. When I went to re-link the table using Access Linked Table Manager, it gave me an error. I then deleted the link to the table, and tried to Link it again using 'Get External Data---Link Tables'. I am getting an error (no surprise!):
" 'dbo.tblSpaceUse.PK_RoomID' is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long".
When I go into Enterprise Manager to 'manage Indexes' on the table, it shows me that the existing index is in fact dbo.tblSpaceUse.PK_RoomID.
About a month ago, I had to rename the index, because it had been pointing to the wrong table. The SQL I used to rename it (in Query Analyzer) is:
EXEC sp_rename 'dbo.tblSpaceUse.PK_RoomID', 'tblSpaceUse.PK_RoomID', 'INDEX'
I have been using the table successfully since then, until today. I have not done anything with the index; the only change I attempted was to delete 3 columns (not related to the index). I do not think I have made any changes to the table since I renamed the index.
I tried to run the rename SQL again (a desperate attempt!) and get the error message:
Server: Msg 15248, Level 11, State 1, Procedure sp_rename, Line 192
Either the parameter @objname is ambiguous or the claimed @objtype (INDEX) is wrong.
Any ideas on what went wrong and what I can do to fix it???
Thanks,
Lori
View 1 Replies
View Related
May 20, 2014
I am using SQL 2008 r2. I have two SQL Queries from 2 different database but they share one server. I need to linked these two SQL Queries as they share the same Primary key which CustomerID see example below
Query 1
Database::Student
Select StudentID , FName, LName
From Student
Query 2
Database ::Finance
Select StudentID,Tution
FROM Payment
I need to be able combine two query which come from two database but they share one server.I would like to use two temp tables so that I can perform a left / right join to retrieve the data by linking two queries using primary id which they both share ( StudentID)
Summary : I have two DB's on the same server. I have two simple select queries for each DB which work correctly.
View 3 Replies
View Related
Jul 20, 2005
I have a table 'Group2Operation' that stores many to many relationsbetween the 'Group' table and the 'Operation' table (each group is haspermission to perform one or more of the available operations)PROBLEM=======I need to prevent duplicate entries being created. e.g. lets say thatin the 'Group2Operation' table a record links the 'editor' group tothe 'publish' operation. Should I prevent an administrator creating aduplicate of that record? (Otherwise deleting that permission willhave to be done twice or more for it to be effective)SOLUTION?=========So far I've done this with a trigger:CREATE TRIGGER Group2OperationDuplicates ON dbo.Group2OperationFOR INSERT, UPDATEAS UPDATE Group2OperationSET NoDuplicate = CONVERT(nvarchar(10),GroupID) + OperationTagThe 'NoDuplicate' unique index column in the Group2Operation tablestores a concatenation of the unique group and operation identifiers.So when an attempt is made to create a record, the trigger is fired.If there is a duplicate, this will mean a duplicate entry in the'NoDuplicate' column. As a result, the INSERT or UPDATE will fail andthe duplication will be prevented.WHAT DO YOU THINK?==================What do you think? Am I going about this in the right way? Is atrigger a good way to do this or should I rely on application logic toprevent duplicates?Any help appreciated by this db novice.John Grist
View 2 Replies
View Related
Dec 3, 2007
Hi there,
I just upsized my access database which has several tables and query linked to one of the tables residing on a seperate access database. When I do add in the diagram section, I see only table, then my question how would I be able to do the same thing under SQL Server 2005? thank you
View 3 Replies
View Related
Nov 17, 2006
After Upsizing a table to sql I linked to that table using access db
Now when i use one of my forms i get a [Invalid Object name "tablename''], not sure why but i am clearly link and the table is in sql!
Can you help!
View 1 Replies
View Related
Mar 15, 2012
I have an assignment where I am to create two tables within a database. One of the tables have the name ContactPerson with the attributes; ID, Forename, Surname, Email, PhoneNumber. The other table is called Company and has the attributes: ID, CompanyName.
Now my problem is that I have to link a ContactPerson to a specific company, but I can't have them in the same table.
I understand that I can use the join statement to show both tables in one query but I need the database to know which person is linked to which company when I implement this databse into my asp.net project.
How do I do this?
View 4 Replies
View Related
Jul 5, 2001
Dear all,
There is now a NEW SQL discussion Group currently being tested;
http://www.baysignia.com/discussions/discussions.xml
Try it out and send comments to faq@baysignia.com
Many Thanks for your comments
SQL DBA
baySignia Systems
View 1 Replies
View Related
Mar 23, 2004
Hi Folks,
Got a topic open for debate.
We currently have an archive table - DDL
CREATE TABLE [dbo].[Audit] (
[id] [int] identity (1,1) NOT NULL ,
[col1] [char] (10) NOT NULL ,
[col2] [char] (15) NOT NULL ,
[col3] [int] NOT NULL ,
[col4] [varchar] (50) NOT NULL ,
[col5] [datetime] NOT NULL ,
[col6] [varchar] (4000) NULL ,
[col7] [char] (3) NULL
)
GO
This table grows to about 40 million rows during the course of the month. The table has a clustered index on the id field and a non clustered index on the col2 and col3. The id column is not used in queries. At the moment we run weekly dbcc reindexes on all the indexes. We are running into a space issue on the reindex of the clustered index (copying the whole table out , ordering etc) and are considering dropping the index or changing to a non clustered index. (The DBCC utility that we have built will only rebuilt all the indexes or none at all.)
I feel this is not a good idea and know my reasons. I would like some input as to why this might prove a bad idea.
Will it increase page splitting? Will the table performance be impacted even if the queries are not specifically using the clustered index?
What are the reasons for and against?
Thanks Folks
View 14 Replies
View Related
Mar 3, 2006
I have transaction table where the rows entered into the transactioncan come a result of changes that take place if four different tables.So the situation is as follows:Transaction Table-TranId-Calc AmountTable 1 (the amount is inserted into the transaction table)- Tb1Id- Tb1AmtTable 2 (an amount is calculated based on the percentage and insertedinto the transaction table)-Tbl2Id-Tb2PercentageTable 3 (the amount is inserted into the transaction table)-Tbl3Id-Tbl3AmutTable 4 (an amount is calculated based on the percentage and insertedinto the transaction table. )-Tbl2Id-Tb2PercentageHow do I create referential integrity between the Transaction table andthe rest of the tables. When I make changes to the values in Table 1 -4, I need to be able to reflect this in the Transaction table.Thanks.
View 6 Replies
View Related
Jul 15, 2015
I am modelling two fact tables of Actuals and Budget which are at different granularity, Actuals are at day, customer and product sub category level. Budgets are at month, Region and Product category level.
Month, Region and Product Category is present in Date, Region and Product Category dimension respectively. I have only three dimensions as Customer, Product and Date. Linking those dimensions to Actual Fact table is not an issue, what is the best way and options are there to link budget fact table to those three dimensions.
View 2 Replies
View Related
Jul 27, 2005
I'm creating a discussion forum for my website, using Sql Server 2000. I need to display 'Number of threads', 'Number of posts', 'Last post by' (username/id and date) for each forum, and 'Number of replies' and 'Last post by' (username/id and date) for each thread.Here are a couple of ideas I have come up with to solve this problem:1) Poll the database (using a stored procedure that returns the number I'm looking for) for each forum when I loop all the fourms. - I suspect this approach isn't optimal, since it creates more traffic to the database.2) Have fields in my Forum and ForumPost tables for 'Number of threads' and so on. Now, create triggers that updates these fields every time a post is made. - I guess this would be much more effective than the first apporach, since everything is done on the database server directly.Are there any other ways that are better? Please advice! Thanks a bunch for any help!
View 7 Replies
View Related
Apr 4, 2001
What are the criteria to decide the optimal(or close to optimal) fill factor?
Any input is appreciated.
View 2 Replies
View Related
Mar 29, 2000
I'm sure this has been a topic in the past. I would like to build a fact sheet about each one and do a compairison. Are there any articles/links/resources out there that speak to this issue?
Thank you,
Nathan
View 2 Replies
View Related
Sep 22, 1998
OK, I`ve been researching the use of the TEXT datatype all day and would
like opinions on what I`ve found.
First, a little background. I have been tasked with writing an ASP
application to handle the display of FAQs for a company`s products. I would
like to store all info in a table much like
faqID int
question TEXT
answer TEXT
Simple enough, right? I then tried to create a stored procedure to add a
new FAQ and all hell broke loose. ASP would not pass anything larger than
255 chars to the stored procedure.
I read in the "ADO and SQL Server Developer`s Guide" from Microsoft about
using varchar datatypes of 255 chars (instead of TEXT) and chunking large
text up to fit in these smaller datatypes. This seems like a lot of work.
I also read in "Inside SQL Server 6.5" that "The text datatype is sometimes
awkward to work with. Many functions don`t operate against text, stored
procedures are limited in what they can do with text, and some tools don`t
deal with it well." (page 632). This statement concerns me greatly. How
are stored procedures limited in dealing with TEXT? Do the standard SQL
UPDATE and INSERT commands work or must READTEXT and UPDATETEXT be used
instead?
I guess my question is, what is the best way to accomplish this? I have a
feeling that others have had to do this before. Is SQL Server not meant to
handle large textual objects? Is chunking the best way to go? Will version
7.0 handle this scenario better?
Any help greatly appreciated!
--Matt Richmond
MenoX Technologies, Inc.
View 1 Replies
View Related
Mar 15, 2002
List-
I have completely lost entry into SQL2000 Discussion List with the following URL:
http://ls.swynk.com/scripts/lyris.pl
This URL taking me to internet.com testlist. I have sent a request to the webmaster but there is no responce.
Anybody know how to get into this forum? I am not able to look at my group messages since yesterday.
Thanks for Redirecting me by any other URL.
Jaganmohan Rao
View 2 Replies
View Related
Jun 18, 1999
I cannot reply to any messages of the board? Is anyone else having this problem?
I see from the board that there haven't been any replies for a few days...
Jarlath O'Grady
mailto:jogrady@swynk.com
http://www.swynk.com/friends/ogrady
View 2 Replies
View Related
Aug 2, 2006
Hello
I have been doing relational database forever(or a long time) and have been intruduces to a team that uses a highly normalized database(propietary) to manage workflow.
We are capturing data in an AUDIT Trail EAV format.(500 million rows)
It is my task to build this into a data warehouse for reporting and I need to have with my team a relational database discussion. The relational database knowledge on this team is DB2 based, IDMS, and other past evolutions.
The common processes used are recieve a flat file and process this file sequentially using C# or VB doing lookups of other databse tables and writing out another flat file to be converted in XML for load to the propritary system.
My goal is to attempt to introduce new design concepts to my team and these are some talking points that I have come up with for a lunch and learn session.
can anyone else add to this list I don't want to get into a deep discussion about 3rd NF, Star Schemas vs Snowflake, etc.. I want to keep is informational and light to eliceit discussion and relat it back to older technologies.
some of the topics we can discuss are:
Why the data warehouse
Real-time tables what needs to stay in prod
What is going to happen to reporting database
Interaction between database on the same cluster/server
Interaction between databases on different servers (linked servers not allowed)
Set processing as opposed to cursor processing.
Table types
EAV
Type1
Type2
Fact
Dimensions
Code
View 1 Replies
View Related
Dec 9, 2007
Hi can anyone help me with the format of my stored procedure below.
I have two tables (Publication and PublicationAuthors). PublicaitonAuthors is the linking table containing foreign keys PublicaitonID and AuthorID. Seeming as one Publication can have many authors associated with it, i need the stored procedure to create the a single row in the publication table and then recognise that multiple authors need to be inserted into the linking table for that single PublicationID. For this i have a listbox with multiple selection =true.
At the moment with the storedprocedure below it is creating two rows in PublicaitonID, and then inserting two rows into PublicationAuthors with only the first selected Author from the listbox??? Can anyone help???ALTER PROCEDURE dbo.StoredProcedureTest2
@publicationID Int=null,@typeID smallint=null,
@title nvarchar(MAX)=null,@authorID smallint=null
AS
BEGIN TRANSACTION
SET NOCOUNT ON
DECLARE @ERROR Int
--Create a new publication entry
INSERT INTO Publication (typeID, title)
VALUES (@typeID, @title)
--Obtain the ID of the created publication
SET @publicationID = @@IDENTITY
SET @ERROR = @@ERROR
--Create new entry in linking table PublicationAuthors
INSERT INTO PublicationAuthors (publicationID, authorID)
VALUES (@publicationID, @authorID)
SET @ERROR = @@ERROR
IF (@ERROR<>0)
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
View 9 Replies
View Related
Dec 9, 2007
Hi can anyone help me with the format of my stored procedure below.
I have two tables (Publication and PublicationAuthors). PublicaitonAuthors is the linking table containing foreign keys PublicaitonID and AuthorID. Seeming as one Publication can have many authors associated with it, i need the stored procedure to create the a single row in the publication table and then recognise that multiple authors need to be inserted into the linking table for that single PublicationID. For this i have a listbox with multiple selection =true.
At the moment with the storedprocedure below it is creating two rows in PublicaitonID, and then inserting two rows into PublicationAuthors with only the first selected Author from the listbox??? Can anyone help???ALTER PROCEDURE dbo.StoredProcedureTest2
@publicationID Int=null,@typeID smallint=null,
@title nvarchar(MAX)=null,@authorID smallint=null
AS
BEGIN TRANSACTION
SET NOCOUNT ON
DECLARE @ERROR Int
--Create a new publication entry
INSERT INTO Publication (typeID, title)
VALUES (@typeID, @title)
--Obtain the ID of the created publication
SET @publicationID = @@IDENTITY
SET @ERROR = @@ERROR
--Create new entry in linking table PublicationAuthors
INSERT INTO PublicationAuthors (publicationID, authorID)
VALUES (@publicationID, @authorID)
SET @ERROR = @@ERROR
IF (@ERROR<>0)
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
View 12 Replies
View Related
Jul 26, 2006
Good day to all.
I'm a DB teacher in a University. Planning and developing SQL exercises for my students I found a "tricky" or extrange sql exercise.
The sql exercise using Northwind DB reads as follows:
"Wich is the total amount of the freight that corresponds to all orders containing products of seafood category ?"
The first sql code that comes to my mind was:
select sum(freight)
from orders o, "order details" d, products p, categories c
where o.orderid=d.orderid and d.productid=p.productid and p.categoryid=c.categoryid
and categoryname='seafood'
This is equivalent code constructed with Query constructor in Enterprise Manager:
SELECT SUM(dbo.Orders.Freight) AS Expr1
FROM dbo.Orders INNER JOIN
dbo.[Order Details] ON dbo.Orders.OrderID = dbo.[Order Details].OrderID INNER JOIN
dbo.Products ON dbo.[Order Details].ProductID = dbo.Products.ProductID INNER JOIN
dbo.Categories ON dbo.Products.CategoryID = dbo.Categories.CategoryID
WHERE (dbo.Categories.CategoryName = N'seafood')
These 2 equivalent queries output 27722.9600 as result, but the correct result (total freight) is 23791.1400.
Did you also think (as I did) that the exposed code is correct?
Now I know the correct sql code that gives the corect answer and also the explanation why the code exposed fails, but before share it under your posible request, want to know your tech comments about this exercise in order to know if this particular exercise is "tricky" (make people to fail) or is my total fault and need to review my strategies of applying/constructing sql (and teaching).
Thanks a lot.
Carlos
View 12 Replies
View Related
Sep 27, 2006
I am about to prepare a paper concerning the field of real-time data mining. Real-time here means the process of incremental training of an existing model as soon as the data arrives.
There is a number of papers introducing algorithms for incremental association analysis, incremental clustering etc. Stream mining Ãs a field which is closely related to that. The main reason for the implementation of incremental algorithms is a) the large amount of data to be mined and b) the high rate of new data that is evolving every day.
Using classical batch mining algorithms, models that are outdated for some reason, would have to be re-trained, which could be very time consuming for billions of records. And once the training is completed, the training would have to be restarted once again because a bulk of new data has been arrived.
The question that I would like to discuss now is: For what real world applications would it be a meaningful or even essential to use real-time training of models?
Two main reasons could determine the answer to that question:
You just want to incorporate new data into existing models in order to increase the prediction accuracy of your model or
Your underlying data is subject to more or less massive changes (also refered to as concept drift) and you want to adapt your mining model continuously to that reality.
I'm looking for some examples or ideas where one of these cases apply and it would be a good idea to have incremental mining algorithms involved.
I'm looking forward to inspiring some discussion on that issue.
View 3 Replies
View Related
Sep 12, 2004
1. Use mssql server agent service to take the schedule
2. Use a .NET windows service with timers to call SqlClientConnection
above, which way would be faster and get a better performance?
View 2 Replies
View Related
Apr 4, 2007
i already find the answer
thanks
View 1 Replies
View Related