SQL Server 2008 :: Linking Two Tables To One

Feb 6, 2015

I have table1(Client widgets) and Table2(Client Toys) I want to link both Table1 and table2 up to Table3(ClientNames)

All tables have a clientid field

I want to right join them so I get all the client widgets and Client toys for each client...

View 2 Replies


ADVERTISEMENT

Linking Two Tables Within One Server

Mar 31, 2008

First off, I am a novice in regards to SQL server and have the rudimentary skills to navigate, execute, query under SQL Server Manager. So, please bear with me.

I am working on a program that was not developed by myself, it is for my business and the company that developed it has gone under, so I have no technical support. The program uses SQL Server and ASP.net. We had a recent hard drive crash and I am in the predicament of having to re-install a new instance of the server onto a new computer. I have the most recent saved "data" files within "Microsoft SQL server/MSSQL/Data" directory. It includes the master, model, MSDB, etc. files.

Long story short, I have been successful in making the program operational again and I can connect to the server properly. It even works when web connecting with internet explorer. The problem I am facing is that all of the data is missing. When I connect through SQL Server Manager, I can see that there are two databases, I will name them "data1" and "data2". When I run a query of the tables, all the data is in "data2". All the stored procedures and tables are identical in both "data1" and "data2".

I am assuming (hopefully I'm right) that "data1" and "data2" are somehow linked or joined in some way. Any insight in how to get these two tables to link would be very much appreciated. Again, I am a novice, and will need help with specific coding that I can put into a query window and execute.

Thanks in advanced.

View 6 Replies View Related

Linking Tables To SQL Server

Apr 23, 2007

I'm new to SQL Server 2000. I decided to purchase this server because my old company (UPS) used the server to help expedite queries and manage on-line reporting. So, now it's up to me to utilize and understand the new server. I have been using MS Access as my front-end for several ad-hoc databases, so I'd like to keep utilizing this method. I want to test my first database using the SQL Server.



I've got everything set up. The IT department has installed the server software on my computer. Within my Access database, I link in tables from a database called "Progress" using a Merant driver. Queries, forms, macros and modules are all pulling from these "linked" tables. Do I need to link these tables into the SQL Server? How do I transistion this database over to SQL? I guess I'm confused about the relationship of how all of this should work.



Right now it looks like this:



PROGRESS ..... linked....... MS Access ....... reporting/results



Where does SQL fit in?

View 1 Replies View Related

Linking Tables Between Databases On Same Server

Aug 29, 2007

Hi, I have 2 similar databases on the same SQL server (due to licencing and customisation issues for off the shelf software).

I would like to create a third database with site specific lookup tables to map data across to site codes, to do summary queries for data reporting, and to create a single point for data access. I can't modify the 2 databases.

I have created the third database and added the necessary tables, relationships, views, etc. But, how do I link to tables in the other databases on the same server so that I can do joins in a query/view ? I have SQL Server Enterprise manager.

Thanks.

View 7 Replies View Related

Linking Access Tables Into SQL Server 2005

May 22, 2008

I am trying to add a linked table to my server, it is an access table.

Here is the code i am using but i get an error:
EXEC sp_addlinkedserver
@server = 'AITdb_be2',
@provider = 'Microsoft.Jet.OLEDB.4.0',
@srvproduct = 'Access',
@datasrc = '\kcapp03deptsCommonEIQAIT DBTestAITdb_be.mdb'
GO

-- Set up login mapping using current user's security context
EXEC sp_addlinkedsrvlogin
@rmtsrvname = 'AITdb_be2',
@useself = 'false',
@rmtuser = 'Admin',
@rmtpassword = ''
GO

-- List the tables on the linked server
EXEC sp_tables_ex 'AITdb_be2'
GO

ERROR:
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "AITdb_be2" returned message "The Microsoft Jet database engine cannot open the file '\kcapp03deptsCommonEIQAIT DBTestAITdb_be.mdb'. It is already opened exclusively by another user, or you need permission to view its data.".
Msg 7303, Level 16, State 1, Procedure sp_tables_ex, Line 41
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "AITdb_be2".

View 3 Replies View Related

When Linking A Server; Only System Tables Are Accessible!

Dec 8, 2005

I added a linked server successfully; but the only tables accessible areonly the system tables!I do have all the rights on both servers (Windows & SQL server).All the non system tables are designated as DBO.Strange thing is that I was able to access the non system tables onlyfrom the query analyzer (not from the SQL Manager tree) by using thefollowing script:EXEC sp_addlinkedserver 'LINKED_SERVER_NAME', N'SQL Server'GOSet ANSI_NULLS onSet ANSI_WARNINGS onGOSelect * From LINKED_SERVER_NAME.Database_name.DBO.table_nameGOThank you very muchMike*** Sent via Developersdex http://www.developersdex.com ***

View 3 Replies View Related

This Is An Access Project Linking Tables On SQL 2005 Server.

May 10, 2006

Looks like the Office 2003 MS Access has no support for creating a linked server and implement design changes. While you could link to the SQL 2005 tables, which show up as queries in MS Access 2003, any further use of the linked queries are not supported unless the Access 2003 version came out after the SQL 2005 release. What kind of an update is needed, or fix is needed so that Access projects can be developed?

View 6 Replies View Related

Connection Fails In Linking SQL Server 2005 Tables Into Access Using DAO 3.51

Aug 21, 2006

Hi,

I have an app that creates and attaches tables from SQL Server into an Access mdb using an ODBC link from VB6 using DAO 3.51 on Windows 2000. Recently I upgraded to SQL Server Express edition and tested it. It worked fine against the Express Edition. So, I installed SQL Server 2005 Standard Edition on our Server hoping that they operate identically. How wrong one can be! the same code that worked against Express Edition does not work on Standard Edition.

It is strange that the App works for about 5 seconds which attaches about 38 tables and after that the connection drops and I have a hell of a time to get the rest of the tables linked. The error that comes up is:

Connection failed:
SQLState: '01000'
SQL Server Error: 10060
[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]ConnectionOpen (connect()).
Connection failed:
SQLState: '08001'
SQL Server Error: 11
[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]General network error. Check your network documentation.

The PC that I am using to connect is in a different domain to the Server where the SQL Server database resides. I thought that domains might be the reason. But even joining the PC to the same domain as the server still does not work and behaves the same. So I do not think it is a domain related issue.

I have also looked at the SQL Server and database configurtaions. I cannot see anywhere any specific time out of around 5 seconds. Even the time out through the SQL Server ODBC driver is set to 30 seconds by default as far as I know. So, it looks like there is a time out somewhere but I am absolutely confused as to where this 5 second time out is comming from.

I also thought permissions on the database or tables might be the issue but after looking at the database and table permissions, they all look OK. The user has prettymuch the same access as the SA on the database.

Has anybody came across this problem? If so, I appreciate if someboday can give me a hint as to where I can start.

Thanks,

View 3 Replies View Related

Problem Linking To Tables In SQL Server 2003 Using MS-Access 2000

Jul 11, 2007

Hi,



I have an MS-Access database on a shared drive.The Access database has tables linked to a SQL server database.When I try to query the tables in MS-Access database by accessing the share drive,I get the ODBC--call failed error.So I tried creating an ODBC driver for the SQL Server and when I try to link the tables,no tables are displayed.Can anyone help me out with this problem?



-Ruth

View 3 Replies View Related

Linking Or Importing Active Directory Objects To SQL Server Tables

Jun 29, 2007

We're trying to figure out whether it's possible to link AD objects to SQL tables. For example, if we have a table of Users and a table of Companies, we'd like to enter the users into Active Directory, create the Companies as either OU's or Security Groups, then have those entities magically appear in the corresponding SQL Server tables. Is that possible? Thanks in advance.

View 1 Replies View Related

Help Linking Tables

Jan 11, 2005

this is the query I need help with

select a.RecordID,a.RelocateID,a.WhenConfirmed,b.RequestI D,b.DocumentID,b.RequestWhen from RelocateeDTA a inner join
docRequests b on ({a.RecordID}=' + CONVERT(VARCHAR, a.RecordID)'= b.WhereClause)

because I am trying to link RelocateeDTA that has RecordID to docRequests that has the same piece of data in field WhereClause but is a varchar, and I am getting an error message (syntax error or access violation)

Could somebody help me please

View 14 Replies View Related

Linking 2 Tables

Apr 24, 2007

dear experts,
i have two tables, tblcustomer and tblform. in tblcustomer i have cutomerid PK and i have also a field that link these two tables customername. in tblforms i have formname. customername and formname are not PK and customername has a lot of null values.
my question is that i want to link these two tables in customerid not the name and also to get the forms used by this customer. the thing is that i have to write a join query.
any suggestion to do that?

thanks my friends

View 14 Replies View Related

Linking Tables

Mar 24, 2006

I know it's possible to link tables between Access and SQL Server using ODBC....however can u use DAO to do this? If there's a way i would appreciate some help. Thanks in advance.

View 2 Replies View Related

Linking External Tables

May 7, 2004

Hi I am a complete sql newbie :)
With that being said I am trying for the life of me to link to a table in another sql database.

For some reason its not letting me link the table instead it is creating a query of the table.

I used the Access upsizing wizard and the access front end.

*grumbles - just wish I could find the upgrading handbook that tells you if you used to do it this way now do it this way*

Thanks
Sara

View 1 Replies View Related

Linking Tables With Views

May 12, 2008

I want to link in a table from another sql server in a view, how is this done?

View 1 Replies View Related

Linking Multiple Tables

Dec 8, 2014

URL...let's say every student in the left table, has a corresponding table to the right. If we were to take the average of all the classes in the corresponding table, how would you be able to transfer that in the table to the left, assuming there could be thousands of these individual tables.

View 4 Replies View Related

Proper Way Of Linking Tables?

May 2, 2015

I am no stranger to Databases, I worked a lot with MySQL but never really cared about proper DB design as long as it worked. Now I am playing with SQL in a ASP.NET project and want to get things done the right way.Let's say I have a Movies database. My movies can have multiple genres so I set my tables up like this:

[Movies]
MovieID
MovieName
MovieRelease

[code]....

Is this the proper way of doing things? The problem with this is when I want to enter a record manually I have to know the ID of the movie and the ID of the Genres of the movie. And what about naming conventions? By default the identifier is always Id, from my MySQL experience I liked naming it like the table, same goes with other columns. This is my T-SQL code for above tables in VS-2013.

CREATE TABLE [dbo].[Movies] (
[MovieID] INT IDENTITY (1, 1) NOT NULL,
[MovieName] VARCHAR (50) NOT NULL,
[MovieRelease] NUMERIC (18) NOT NULL,
CONSTRAINT [PK_Movies] PRIMARY KEY CLUSTERED ([MovieID] ASC)

[code]....

View 2 Replies View Related

Confused With Linking Tables

Dec 13, 2007

Hi and thanks for taking the time to read this. I get really confused really quickly when it comes to table linking, and I think I am doing it the hard way. I am going to show my stupidity and ask if there is a better way than what I do, because it takes a LOT of querying and seems like a huge waste.

In reality, I have about 20 tables to join like this, but I'm going to use three for the example:

"Main" Table
AcctNoNameHeightWeight
1Bob13
2Phil21
3Jim15
4Lisa22

"Height" Table
HeightIDHeightName
1Giant
2Tall
3Medium
4Short

"Weight" Table
WeightIDW_Name
1Skinny
2Normal
3Overweight
4Obese


What I have been doing is:

SELECT
Main.AcctNo,
Main.Name,
Height.HeightName,
Weight.WeightName
FROM
Main
INNER JOIN Height ON
Height.HeightID = Main.Height
INNER JOIN Weight ON
Weight.WeightID = Main.Weight
WHERE Main.AcctNo < 3


My question: is doing 20 INNER JOINS really the best way to do this with 20 tables, or is there some other way to link Main.Height to Height.HeightID that is less intensive?

Thanks again for reading, and in advance for any information or insight you can provide.

View 1 Replies View Related

Query Linking Two Tables

Feb 12, 2008

I have two tables, one for cases and one for inventors. When I query a case linked to the inventor table I get as many rows as there are inventors. Is there a way that I can get just one row for the case and have the inventors lists Doe, John; Doe, Jane; Buck, Jack? I usually export results to Excel and my people want the inventors in one column for certain reports.
I would search for it but I don't know what it's called.
Thanks,
Don

View 1 Replies View Related

Problem Linking Tables

Jul 23, 2005

I have two tables, TableA and TableB.Each has a date in smalldatetime format.TableA has a qty field in int format.TableB also has a nvarchar field in which the date is in the formatYYYYMMDDA simple Query on TableA sum Qty returns a result of 100.However, When I do a left outer join from TableA to TableB on Date, thesum of Qty on TableA becomes massivley larger.What could be causing this?Regards,Ciarán

View 2 Replies View Related

Linking Tables From Other Databases?

Jan 18, 2007

In a database, I am creating a new db. From there, I am setting up thetables, so that I can eventually create a front end (usually access,but I may attempt to be brave and lose the shell.) Anyway, I want touse a table, read-only for a lookup. It exists in another database onour system. Is there a way for me to link it into this database that Iam working on? I would think of it like in access when you go to do anew table and you choose to link the table from somewhere else. Thatis what I want to do. Can anyone possibly step me through this?I know basics of sql server and like to learn.Thanks!

View 3 Replies View Related

Linking Lookup Tables

Jul 20, 2005

Hi,If you have lookup tables which are used by multiple tables (e.g.'City' lookup table might be used by the 'Employee' and the 'Company'tables) do we need to link it to both tables? Or can it sit by itselfand just referenced?Cheers,Jack

View 2 Replies View Related

Problem With Linking Tables

Jul 16, 2007

I have an Access database that contains local files and files linked on a SQL server through a DNS connection. I have been using this for years and during that time I have dropped links, added links, changed the DNS server information, etc.



I changed the DNS server information this weekend, deleted all the links, and was ready to start linking the tables with the new DNS information. I click on File >> Get External Data >> Link Tables and am given the traditional file selection dialogue. I go to the bottom (Files of Type) and scroll to the last selection... ODBC Databases().



In the past, after I made that selection, I would then be taken to the ODBC dialogue from my computer to select the connection type and then the actual connection.



Now however, the dialogue immediately stops. It doesn't lock, it just stops and returns me to the Database window from my database as though I wasn't doing anything.



I have reinstalled Office and redone all the updates. Does anyone have any suggestions?



Thanks,

Gary

View 4 Replies View Related

Linking Tables From Different Databases

Feb 18, 2006

Can Anyone Help? I have 2 Databases, Database1 and Database2.

Database1 is a content management backend database including a helpdesk and support ticket tracking table.
Database2 is a clients complete website

How do i link the tables from Database1 into Database2 so that the client can view the helpdesk thru their content management system.

(Client1, Client2, Client3 etc... will all have access to the same Database1)

Any help someone could give me would be a big help

View 3 Replies View Related

Linking To External Tables

Jun 26, 2006

I am trying to create a single query from 2 tables on different SQL servers. In Access 2003 I have been able to accomplish this by created a Linked Table via ODBC connection to a table then create my query reference the linked table.

Is something link this possible with SQL? Any direction would be greatly appriciated!

Scenerio:

Server1

Books

Book_ID
Book_Author
Book_Title
Server2

PurchasedBooks

Customer_ID
Book_ID
vPurchasedBooks (View on Server 2)

Customer_ID
Book_Title (Joined on Book_ID on Server1Books)



View 1 Replies View Related

Linking Tables From MS Access

Apr 21, 2015

Is there a way to link MS Access tables with SQL Server tables so the client app sees them as tables from one database?

I have tried linked server but it appears that it gets stale after a while and needs to be re linked from time to time which is not very practical.

View 2 Replies View Related

Linking Multiple Tables In An SQL Query

Jun 17, 2006

Hello,
I have a table called "ShoppingCart" which has fields for CartID, UniqueID and Quantity. At the moment I haven't specifed a primary key for this table becuase none of the fields are unique. I need to be able to link this ShoppingCart table to a table called "Size" using the UniqueID (both tables contain a field for UniqueID) in order to obtain the ProductID and CategoryID of the data item. I then need to link the ProductID and CategoryID I obtained from the first part of the SQL statement to a table called "plants" in order to get information from the following fields in the plants table: Common_Name, Latin_Name and Thumb_URL.
So far I've been able to use an INNER JOIN with the Size table to obtain the ProductID and Category ID using....
SELECT * FROM ShoppingCart INNER JOIN Size ON ShoppingCart.UniqueID = Size.UniqueID WHERE CartID = @CartID ORDER BY ProductID
I now need to be able to use the ProductID and Category ID I've obtained from this part of the query to reference the Common Name, Latin Name etc of the data item from the plants table. Is there any way that I could do this?
I do sometimes wonder if I'm making this whole thing a lot more complicated than it needs to be. At the moment I'm storing details about the different types of plants the garden centre sells in the "plants" table. However, some plants are available in different sizes so I've got a table called "Size" which links to the plants table using the ProductID and CategoryID of data items. The Size table has a unique primary key field called "UniqueID" which is used to uniquely identify every plant that the garden centre sells (this cannot be done using Product/CategoryID becuase different sizes of the same plant have the same ProductID/CategoryID). I'm then storing just the CartID, UniqueID and Quantity in the "ShoppingCart" table. There must be an easier way of structuring the whole thing!
I'd really appreciate any help you can offer me.
Many thanks,
Luke

View 1 Replies View Related

Linking Two Tables In A Detail View

Apr 10, 2007

I have a province table in a my database.  I would like to link this province table to a resource table's Province_ID.  This Province_ID is an int.
Vic Valentic
CEO/President
Open Door
2 Elite Dr. #33
Hamilton, Ontario
L8W 2N3
905-389-7492
http://www.wlu.ca/next/opendoor

View 6 Replies View Related

SQL 2000 Linking Tables To Access

Oct 23, 2004

Hi, I need to link an Access 97 database to sql server 2000. I can't use Enterprise Manager so I have created a simple asp.net page using sp_addlinkedserver and sp_addlinkedsrvlogin.

The mdb file is on a network share, then I have permissions problems: here is a sample

sp_addlinkedserver 'test', 'Access 97', 'Microsoft.Jet.OLEDB.4.0',
'\SVKNFS080Pshareaccess97db1.mdb', 'efco'

sp_addlinkedsrvlogin 'test', false, 'sa', 'Admin', NULL

I have no problems executing these stored procedures (the linked server is added in sysservers table), but when I try to query the access database

SELECT * FROM test...profile

I get this error

Microsoft][ODBC SQL Server Driver][SQL Server][OLE/DB provider returned message:
The Microsoft Jet database engine cannot open the file '\SVKNFS080Pshareaccess97dboutlet.mdb'. It is already opened exclusively by another user, or you need permission to view its data.]

The mdb file is not locked, I think is a permission's problem.

Can anyone help me ?

Thanks in advance

View 1 Replies View Related

Max Date In Linking 2 Tables For Update

May 27, 2003

I have a table called ppd2002, which has an id field a testdate field (datetime), and a previoustesdate field (datetime). The testdate field is filled in. I have another table called ppd which has an id field and a testdate field. I need to update the ppd2002 field called previoustestdate with the max(testdate) field from ppd, but that max date must be less than the current testdate in the ppd2002 field. The id field is the link field between the 2 tables. Tried to create a view, then a update but still stuck.

View 2 Replies View Related

Linking Database Tables On Different Servers?

Oct 16, 2015

I have two production servers with two different databases and I was thinking about using Linked Servers, but never did this before.Found this stored procedure

sp_addlinkedserver('servername').Would you just execute this and then run your query after the SP?

View 8 Replies View Related

Help With Update Query Linking 3 Tables

Jul 23, 2005

I am looking for some assistance with an update query that needs to link 3tables:This query ran and reported over 230,000 records affected but did not changethe field I wanted changed, not sure what it did.I did notice that the "name" in "GM_NAMES.name" was colored blue in QueryAnalyzer. Is it bad to name a column "name"?UPDATE ABSENCESset CustomerContactID = cicntp.cnt_idfrom absences, cicntpwhere (SELECT cicntp.cnt_l_nameFROM cicntp INNER JOINgm_names ON cicntp.cnt_l_name = GM_NAMES.name INNER JOINAbsences ON cicntp.cnt_id = Absences.CustomerContactID)Next I tried this query which is still running after 75 minutes (on alaptop)update absencesset CustomerContactID = cicntp.cnt_idfrom absences, cicntp, gm_nameswhere gm_names.name= cicntp.cnt_l_nameAs you can see, the 3 tables are ABSENCES, CICNTP and GM_NAMES.Absences.CustomerContactID is what I need updated, when finished it shouldmatch CICNTP.cnt_idGM_NAMES is a temp table and matches records in CICNTP.cnt_l_nameCan some of you school this newbie on the best way to do this?Thanks a bunch!

View 4 Replies View Related

Tables Design And Linking For A Job Portal

Feb 28, 2008



Hi,

Currently i am developing a job portal in ASP 2.0, SQL Server 2005 which involves Job Seeker registration, Searching of resumes, applying for job Posting, Employer Registration, Create Job Posting, Searching for Job Seeker etc.
The Job Seeker is allowed to upload a word document of size up to 500Kb which is stored in Table as varbinary.

Right now I have MemberShip/Roles in seperate database. The Job Portal Tables are in seperate Database. I was told to split the Tables so that Tables of JobSeeker are One database and Employer to another Database so that they speed up the performance.

I have several tables that bridge (thats either store id's of Job Seeker or Employer) like Job Postings applied, Saved Postings Job Seeker, Job Postings of the Employer, Job Posting (Applied ones) alert etc.

Can any give me how to create a good Database design (one or more) with excellent performation. Right now I have one Database for Job Portal related tables excluding membership. The mapping of key fields including the fields that are enabled for Text indexing are given below.

(JobSeekerTable - Stores Personal Details)
JobSeekerId (PK)
...............

(JobSeekerResumeTable - Stores Resume Details)
JobSeekerResumeId (PK)
JobSeekerId (FK)
Job Title (enabled Text Indexing)
........

(JobSeekerDocTable - Stores Resume Details)
JobSeekerDocId (PK)
JobSeekerId (FK)
Resume (as varbinary) (enabled Text Indexing)
Covering Letter (Text)
........

(JobSeekerPostingTable - Stores Job Postings Saved by the Job Seeker)
JobSeekerPostingId(PK)
JobSeekerId (FK)
JobPostingId (FK)
......

(JobSeekerAppliedTable - Stores Job Postings Applied by the Job Seeker)
JobSeekerAppliedId(PK)
JobSeekerId (FK)
JobPostingId (FK)
.....

(CompanyTable - Employer Details)
CompanyId(PK)
.....

(JobPostingTable - Stores the information of the Job Posting created by Employer)
JobPostingId(PK)
CompanyId(FK)
Job Title (enabled Text Indexing)
Job Desc(enabled Text Indexing)
.....

(JobPostingConTable - Stores the information of the Job Posting Location Details )
JobPostingConId(PK)
JobPostingId(FK)
.....

(CompResumeSaved - Job Seeker details saved by Employer)
CompResumeSaved(PK)
CompanyId(FK)
JobSeekerId(FK)
.....

Eventually more tables would be added. Can any one tell me how to speed up the performance (particulary search engine fo Employer for searching resumes & Jobseeker for searching job Postings.) I hope I have mentioned everything clearly.

Thanks,
Uma Ramiya








View 4 Replies View Related







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