• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 571
  • Last Modified:

Get data from server 2

Hi!

Need a query that return a field (server2), if the filed exist on server2

Have this code:

SELECT Varenr,
    (
        SELECT
            LST.[ITEMID]
        FROM
            [hgnn-sql01].[axdb-drift].[DBO].[CUSTVENDEXTERNALITEM] AS LST
        WHERE
            LST.[EXTERNALITEMID]=ART.Varenr) AS 'VarenummerHGN'
    (
FROM
    dbo.VEC_Artikkel AS ART

Open in new window


I am using a existing serverlink -> hgnn-sql01

Need to select ALL LST.[ITEMID] where  LST.[EXTERNALITEMID]=ART.Varenr) AS 'VarenummerHGN

But cant get this query to work ?
0
team2005
Asked:
team2005
1 Solution
 
Habib PourfardCommented:
Is this what you are looking for?
SELECT LST.[ITEMID]
FROM dbo.VEC_Artikkel AS ART
	INNER JOIN [hgnn-sql01].[axdb-drift].[DBO].[CUSTVENDEXTERNALITEM] AS LST ON LST.[EXTERNALITEMID] = ART.Varenr

Open in new window

0
 
EvilPostItCommented:
I would assume that you are getting an error relating no linked server being created called [hqnn-sql01].

Have a look at the below article.

http://msdn.microsoft.com/en-us/library/aa560998.aspx
0
 
team2005Author Commented:
Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now