[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Import View from another SQL Server, using date range

Posted on 2006-04-27
7
Medium Priority
?
220 Views
Last Modified: 2009-07-29
I have another SQL server I wish to import data from.  The other server's database has a view I would like to import, but I would like to limit this import to specific dates or date ranges.  This is something I am going to put into a bigger stored procedure using variables so that a web app can call the procedure, pass the date range and run the process.  What is the best way to accomplish this?

I know I can import the whole view but it has a lot more data then I need and would really slow the process down.

Thanks!
0
Comment
Question by:drliebs
  • 3
  • 3
7 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 16557065
What are you trying to do?  Import the View or import the data from the View?
0
 

Author Comment

by:drliebs
ID: 16557485
Import the data from the view.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 16558617
Is the other server linked, if not can you link it?
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 

Author Comment

by:drliebs
ID: 16561989
<i> Is the other server linked, if not can you link it?</i>

Not sure how to answer that, but I have complete access to both servers so I am sure I could accomplish this.  I have successfully imported ALL of the data into server 2 by referencing the view on server 1.  I just don't want my routine to import all data everytime it runs.  Does that clarify my situation?
0
 
LVL 28

Expert Comment

by:imran_fast
ID: 16567667
>  I just don't want my routine to import all data everytime it runs.  Does that clarify my situation?
Put where Clause in your view something like

Select * from youviewName where datebetween '2006-04-01' and '2006-05-01'

0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 1000 total points
ID: 16569211
>>Not sure how to answer that, but I have complete access to both servers so I am sure I could accomplish this. <<
Than all you have to do is link (look up Linked Servers in Books Online) the server with the view and use it as follows:

Select *
From  OtherServer.databasename.databaseowner.viewname
0
 

Author Comment

by:drliebs
ID: 16589796
Eureka!  Took me awhile to get the hang of setting up the linked server but that makes life so much simpler.  

Thanks!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

865 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question