?
Solved

Extract queried tables from SQL to Access

Posted on 2012-03-15
5
Medium Priority
?
315 Views
Last Modified: 2012-03-20
I need to extract some data from our SQL server to an access mdb. However, it needs to be only the stuff that was edited today. I have the queries for getting the info, and it all works in a normal SQL query, but when I put it into the export wizard as a custom script, it only does the first table. What am I doing wrong? Below is the script that I'm using.

Thanks
BA

SELECT cIns.* FROM Install AS Ins inner join cInstall AS cins ON Ins.UID = cins.MasterUID Where (Ins.Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Ins.Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
SELECT cIss.* FROM Issue AS Iss inner join cIssue AS cIss ON Iss.UID = cIss.MasterUID Where (Iss.Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Iss.Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from Classes Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from Code Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
SELECT cSer.* FROM Service AS Ser inner join cService AS cSer ON Ser.UID = cSer.MasterUID Where (Ser.Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Ser.Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from Cust Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from CustCont Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from CustEQTrans Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from CustEquip Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from Defaults Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from Install Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from InvenDetail Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from InvenGroup Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from InvenSnap Where (Snapshotdate >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Snapshotdate < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from Inventory;
select * from InvenTrans Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from Invoice Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from Issue Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from IssueStatus Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from Location Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from Maint Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from MaintEQ Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from MatDetail  Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from OrderDetail Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from OrderMat Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from OrderStatus Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from Paydetail Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from Payment Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from PayMethod Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from PayTypes;
select * from Service Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from ServiceItem  Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from ShipMeth Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from SLACategory  Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from SMPLink  Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from SMPLinkSetup Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from SMPSystem Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from SMPUser Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from Terms Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from Vehicle Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from VendItem Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from Vendor Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from VFuel Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from VMaint Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
select * from Zones Where (Editdatetime >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) AND (Editdatetime < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1));
0
Comment
Question by:bachopper
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 16

Expert Comment

by:brad2575
ID: 37726386
You can do a few diffent things depending on what/how the data is:


Is all the data the same just from different sources?  If so you can do UNION on all the statements to get them all at once.

Or create a seperate export for each query.

Use a View do combine them all then export the view results

Populate a temp/working table then just export that table

If you have ability to use SSIS (or DTSX) you can use that (a more advanced version of Export Wizard) and actually export wizard will generate 1 of the 2 files (SSIS or DTSX) and let you save it.
0
 

Author Comment

by:bachopper
ID: 37726458
It's from the same database, different tables. And I am using SSIS, but I can't seem to find in the wizard where to customize the data I want, other than the "Use a custom script" section.
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 1500 total points
ID: 37731681
but when I put it into the export wizard as a custom script, it only does the first table. What am I doing wrong?
You need to do each one separately.
0
 

Author Closing Comment

by:bachopper
ID: 37737523
Not the answer I was looking for, but I guess it'll have to do.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

752 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