Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Create a View from Data on another SQL Server
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
Brian Conner via SQLMonster.com  
View profile   Translate to Translated (View Original)
 More options 5 Nov, 14:40
Newsgroups: microsoft.public.sqlserver.programming
From: "Brian Conner via SQLMonster.com" <u47161@uwe>
Date: Thu, 05 Nov 2009 14:40:18 GMT
Local: Thurs 5 Nov 2009 14:40
Subject: Create a View from Data on another SQL Server
I have an SQL Server that I have ADMIN Rights on and I would like to create a
View from Data on an SQL Server that I have Read Only Rights on, can this be
done? If so what would the Syntax be?

I tried something like below but it didn't work...

Create View  NameOfView

as

Select Data

from

ServerName.DatabaseName.dbo.Table

--
Brian Conner

Message posted via http://www.sqlmonster.com


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tibor Karaszi  
View profile   Translate to Translated (View Original)
 More options 5 Nov, 15:02
Newsgroups: microsoft.public.sqlserver.programming
From: "Tibor Karaszi" <tibor_please.no.email_kara...@hotmail.nomail.com>
Date: Thu, 5 Nov 2009 16:02:12 +0100
Local: Thurs 5 Nov 2009 15:02
Subject: Re: Create a View from Data on another SQL Server
Set up the remote server as a "linked Server" (more info on linked servers
in BOL).

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi

"Brian Conner via SQLMonster.com" <u47161@uwe> wrote in message
news:9eaa01a6d7fc1@uwe...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Russell Fields  
View profile   Translate to Translated (View Original)
 More options 5 Nov, 15:09
Newsgroups: microsoft.public.sqlserver.programming
From: "Russell Fields" <russellfie...@nomail.com>
Date: Thu, 5 Nov 2009 10:09:47 -0500
Local: Thurs 5 Nov 2009 15:09
Subject: Re: Create a View from Data on another SQL Server
Brian,

Please always say what "it didn't work" means.  Did you get an error
message?  What was it?  Etc.  (And what version of SQL Server are you
running?)

Anyway, your syntax for creating a cross-server view is fine.  I imagine
that you probably have not defined a linked server for the view to use.
Linked servers must be defined to support this cross-server view.  (Why?
Just think of it as the server running the query, not you personally running
the query.  The SQL Server needs to understand what is going on from
information defined within the SQL Server.)  Here is an example:

-- Defines the linked server (the "servername" in the 4 part name.)
EXEC master.dbo.sp_addlinkedserver @server = N'ServerName',
 @srvproduct=N'Linked Server', @provider=N'SQLNCLI',
 @datasrc=N'ServerName', @catalog=N'DatabaseName'

-- This sets up the linked server to use your personal permissions.
EXEC master.dbo.sp_addlinkedsrvlogin
@rmtsrvname=N'ServerName',@useself=N'True',
  @locallogin=NULL,@rmtuser=NULL,@rmtpassword=NULL

After that, you can create your view:

Create View  NameOfView
as
Select Data
from
ServerName.DatabaseName.dbo.Table

Note that the linked server name does not have to be the same as the name of
the physical server.  The data source, of course, needs the name of the
server.

RLF

"Brian Conner via SQLMonster.com" <u47161@uwe> wrote in message
news:9eaa01a6d7fc1@uwe...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google