MsSQL

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsDatabasesMsSQL

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old January 17th, 2018, 03:25 PM
sirnorman sirnorman is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Jan 2018
Posts: 0 sirnorman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 50 m 30 sec
Reputation Power: 0
Query to linked server duplicating columns

Hi all,

I am teaching myself SQL after being lazy for years and using the MS Access query builder. I am using SSMS with a local SQL server to query against a table on a linked server which is a company server.

The goal is to eventually append to linked server table 'loctab' from local server table 'Storeloc' however at the moment I am just building the select query to display only the results I want. Now both the tables have the same columns and the Storeloc table has all the records from loctab plus a heap more. I'm trying to display only the records that are not yet in loctab but for some reason it is displaying two sets of all the columns side by side ie

loctab | Storeloc
A|B|C | A|B|C

Query result
A|B|C|A|B|C

Code:
select distinct * from [annoyingly.long.linkedserver.name].Customer_Hosting.dbo.location as loctab
right join dbo.Storeloc on loctab.LocationID = dbo.Storeloc.LocationID
where loctab.LocationID is null


If you see any bad habits in my code please correct me also as I'd rather weed those out before they become ingrained

Reply With Quote
Reply

Viewing: Tutorialized ForumsDatabasesMsSQL > Query to linked server duplicating columns


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap