how do I import data in excel form SQL server?

Hello All,

  I've been trying to import data into excel from our SQL server.  I have 
the sql script yielding the results.  The real problem is when I use the data 
connectivity wizard, it only allows you to select one table from the database 
in your SQL server.  However, my script involves two tables with a join.  Any 
ideas would be helpful

Thanks,

Mitch
0
Utf
4/14/2010 8:22:03 PM
excel.worksheet.functions 4936 articles. 2 followers. Follow

7 Replies
1379 Views

Similar Articles

[PageSpeed] 21

Asuming you have rights on the Server, convert your 'script' (by which you 
probably mean query?) into a view.  If you don't have adequate rights, then 
use MS Query to connect to SQL Server and use your query text there.

"Mitch" wrote:

> Hello All,
> 
>   I've been trying to import data into excel from our SQL server.  I have 
> the sql script yielding the results.  The real problem is when I use the data 
> connectivity wizard, it only allows you to select one table from the database 
> in your SQL server.  However, my script involves two tables with a join.  Any 
> ideas would be helpful
> 
> Thanks,
> 
> Mitch
0
Utf
4/14/2010 8:43:02 PM
Thanks Duke.  Im really new to SQL.  I have here a Server Management studio 
and an SQL query analyzer.  Which one should I use.  Both could give me 
results to grid.  How do I change it into view?  After this, what do I do to 
connect the results to Excel(import)?

"Duke Carey" wrote:

> Asuming you have rights on the Server, convert your 'script' (by which you 
> probably mean query?) into a view.  If you don't have adequate rights, then 
> use MS Query to connect to SQL Server and use your query text there.
> 
> "Mitch" wrote:
> 
> > Hello All,
> > 
> >   I've been trying to import data into excel from our SQL server.  I have 
> > the sql script yielding the results.  The real problem is when I use the data 
> > connectivity wizard, it only allows you to select one table from the database 
> > in your SQL server.  However, my script involves two tables with a join.  Any 
> > ideas would be helpful
> > 
> > Thanks,
> > 
> > Mitch
0
Utf
4/14/2010 9:04:01 PM
Well, you're asking a lot.

You can use SQL Management Studio to convert your query into a view by using 

Create View [viewname] as
and then paste in your query

then you execute that query and, if all goes well, you'll have a view.  A 
view is nothing more than a virtual table.

Alternatively, use your query in Excel.  What version of Excel are you 
using?  In 2007, on the data tab, under From Other Sources you can find MS 
Query.  In 2003 it's under the Data menu somewhere. Use that to connect to 
SQL and follow the prompts.  Select one of your tables to get past the early 
steps.  Toward the end there is an option to edit the thing in MS Query. When 
you get there, click on the SQL button and delete what is there, replacing it 
with your query.  Follow the steps to run the query and return the data to 
your worksheet

"Mitch" wrote:

> Thanks Duke.  Im really new to SQL.  I have here a Server Management studio 
> and an SQL query analyzer.  Which one should I use.  Both could give me 
> results to grid.  How do I change it into view?  After this, what do I do to 
> connect the results to Excel(import)?
> 
> "Duke Carey" wrote:
> 
> > Asuming you have rights on the Server, convert your 'script' (by which you 
> > probably mean query?) into a view.  If you don't have adequate rights, then 
> > use MS Query to connect to SQL Server and use your query text there.
> > 
> > "Mitch" wrote:
> > 
> > > Hello All,
> > > 
> > >   I've been trying to import data into excel from our SQL server.  I have 
> > > the sql script yielding the results.  The real problem is when I use the data 
> > > connectivity wizard, it only allows you to select one table from the database 
> > > in your SQL server.  However, my script involves two tables with a join.  Any 
> > > ideas would be helpful
> > > 
> > > Thanks,
> > > 
> > > Mitch
0
Utf
4/15/2010 12:27:01 AM
Here's a link, too, that might help.  Go all the way to the bottom of the 
page to read about MS Query

http://www.nickhodge.co.uk/gui/datamenu/dataexamples/externaldataexamples.htm


"Mitch" wrote:

> Thanks Duke.  Im really new to SQL.  I have here a Server Management studio 
> and an SQL query analyzer.  Which one should I use.  Both could give me 
> results to grid.  How do I change it into view?  After this, what do I do to 
> connect the results to Excel(import)?
> 
> "Duke Carey" wrote:
> 
> > Asuming you have rights on the Server, convert your 'script' (by which you 
> > probably mean query?) into a view.  If you don't have adequate rights, then 
> > use MS Query to connect to SQL Server and use your query text there.
> > 
> > "Mitch" wrote:
> > 
> > > Hello All,
> > > 
> > >   I've been trying to import data into excel from our SQL server.  I have 
> > > the sql script yielding the results.  The real problem is when I use the data 
> > > connectivity wizard, it only allows you to select one table from the database 
> > > in your SQL server.  However, my script involves two tables with a join.  Any 
> > > ideas would be helpful
> > > 
> > > Thanks,
> > > 
> > > Mitch
0
Utf
4/15/2010 11:05:01 AM
Got an error message that read " changed database context to [table name 
inside the data base].  What does this mean?

"Duke Carey" wrote:

> Well, you're asking a lot.
> 
> You can use SQL Management Studio to convert your query into a view by using 
> 
> Create View [viewname] as
> and then paste in your query
> 
> then you execute that query and, if all goes well, you'll have a view.  A 
> view is nothing more than a virtual table.
> 
> Alternatively, use your query in Excel.  What version of Excel are you 
> using?  In 2007, on the data tab, under From Other Sources you can find MS 
> Query.  In 2003 it's under the Data menu somewhere. Use that to connect to 
> SQL and follow the prompts.  Select one of your tables to get past the early 
> steps.  Toward the end there is an option to edit the thing in MS Query. When 
> you get there, click on the SQL button and delete what is there, replacing it 
> with your query.  Follow the steps to run the query and return the data to 
> your worksheet
> 
> "Mitch" wrote:
> 
> > Thanks Duke.  Im really new to SQL.  I have here a Server Management studio 
> > and an SQL query analyzer.  Which one should I use.  Both could give me 
> > results to grid.  How do I change it into view?  After this, what do I do to 
> > connect the results to Excel(import)?
> > 
> > "Duke Carey" wrote:
> > 
> > > Asuming you have rights on the Server, convert your 'script' (by which you 
> > > probably mean query?) into a view.  If you don't have adequate rights, then 
> > > use MS Query to connect to SQL Server and use your query text there.
> > > 
> > > "Mitch" wrote:
> > > 
> > > > Hello All,
> > > > 
> > > >   I've been trying to import data into excel from our SQL server.  I have 
> > > > the sql script yielding the results.  The real problem is when I use the data 
> > > > connectivity wizard, it only allows you to select one table from the database 
> > > > in your SQL server.  However, my script involves two tables with a join.  Any 
> > > > ideas would be helpful
> > > > 
> > > > Thanks,
> > > > 
> > > > Mitch
0
Utf
4/15/2010 2:21:01 PM
Duke, 

am using Excel 2003.  In the edit query window, do I erase everything? the 
connection text etc, select SQL as command type and then paste my 
script/query on teh bottom dialog box? I get an error like the context was 
changed, or it indicates that the table I selected from the database is 
invalid and such.

"Duke Carey" wrote:

> Well, you're asking a lot.
> 
> You can use SQL Management Studio to convert your query into a view by using 
> 
> Create View [viewname] as
> and then paste in your query
> 
> then you execute that query and, if all goes well, you'll have a view.  A 
> view is nothing more than a virtual table.
> 
> Alternatively, use your query in Excel.  What version of Excel are you 
> using?  In 2007, on the data tab, under From Other Sources you can find MS 
> Query.  In 2003 it's under the Data menu somewhere. Use that to connect to 
> SQL and follow the prompts.  Select one of your tables to get past the early 
> steps.  Toward the end there is an option to edit the thing in MS Query. When 
> you get there, click on the SQL button and delete what is there, replacing it 
> with your query.  Follow the steps to run the query and return the data to 
> your worksheet
> 
> "Mitch" wrote:
> 
> > Thanks Duke.  Im really new to SQL.  I have here a Server Management studio 
> > and an SQL query analyzer.  Which one should I use.  Both could give me 
> > results to grid.  How do I change it into view?  After this, what do I do to 
> > connect the results to Excel(import)?
> > 
> > "Duke Carey" wrote:
> > 
> > > Asuming you have rights on the Server, convert your 'script' (by which you 
> > > probably mean query?) into a view.  If you don't have adequate rights, then 
> > > use MS Query to connect to SQL Server and use your query text there.
> > > 
> > > "Mitch" wrote:
> > > 
> > > > Hello All,
> > > > 
> > > >   I've been trying to import data into excel from our SQL server.  I have 
> > > > the sql script yielding the results.  The real problem is when I use the data 
> > > > connectivity wizard, it only allows you to select one table from the database 
> > > > in your SQL server.  However, my script involves two tables with a join.  Any 
> > > > ideas would be helpful
> > > > 
> > > > Thanks,
> > > > 
> > > > Mitch
0
Utf
4/15/2010 2:35:01 PM
Use the link to Nick Hodge's site.  Nearly at the bottom of that page he 
shows you how to get t0 MS Query.  You don't change any of the connection 
info or any of the preliminary screens.

When you get to the screen that allows you to Edit in MS Query, be sure to 
choose that option and click Finish.  Now you'll be in the actual query 
designer and that is where you click on the SQL button on the toolbar.  In 
the window that pops up you replace all THAT TEXT with your query text from 
SQL Server Mgt Studio.  Then follow the rest of Nick's instructions

"Mitch" wrote:

> Duke, 
> 
> am using Excel 2003.  In the edit query window, do I erase everything? the 
> connection text etc, select SQL as command type and then paste my 
> script/query on teh bottom dialog box? I get an error like the context was 
> changed, or it indicates that the table I selected from the database is 
> invalid and such.
> 
> "Duke Carey" wrote:
> 
> > Well, you're asking a lot.
> > 
> > You can use SQL Management Studio to convert your query into a view by using 
> > 
> > Create View [viewname] as
> > and then paste in your query
> > 
> > then you execute that query and, if all goes well, you'll have a view.  A 
> > view is nothing more than a virtual table.
> > 
> > Alternatively, use your query in Excel.  What version of Excel are you 
> > using?  In 2007, on the data tab, under From Other Sources you can find MS 
> > Query.  In 2003 it's under the Data menu somewhere. Use that to connect to 
> > SQL and follow the prompts.  Select one of your tables to get past the early 
> > steps.  Toward the end there is an option to edit the thing in MS Query. When 
> > you get there, click on the SQL button and delete what is there, replacing it 
> > with your query.  Follow the steps to run the query and return the data to 
> > your worksheet
> > 
> > "Mitch" wrote:
> > 
> > > Thanks Duke.  Im really new to SQL.  I have here a Server Management studio 
> > > and an SQL query analyzer.  Which one should I use.  Both could give me 
> > > results to grid.  How do I change it into view?  After this, what do I do to 
> > > connect the results to Excel(import)?
> > > 
> > > "Duke Carey" wrote:
> > > 
> > > > Asuming you have rights on the Server, convert your 'script' (by which you 
> > > > probably mean query?) into a view.  If you don't have adequate rights, then 
> > > > use MS Query to connect to SQL Server and use your query text there.
> > > > 
> > > > "Mitch" wrote:
> > > > 
> > > > > Hello All,
> > > > > 
> > > > >   I've been trying to import data into excel from our SQL server.  I have 
> > > > > the sql script yielding the results.  The real problem is when I use the data 
> > > > > connectivity wizard, it only allows you to select one table from the database 
> > > > > in your SQL server.  However, my script involves two tables with a join.  Any 
> > > > > ideas would be helpful
> > > > > 
> > > > > Thanks,
> > > > > 
> > > > > Mitch
0
Utf
4/15/2010 2:49:01 PM
Reply:

Similar Artilces:

Voice connector on Exchange server 2007.
Is there any functionality available in exchange server 2007 regarding voice connector? If not how can we create it? Thanks in advance. Ashwin Exchange 2007 has the "Universal Messaging" role which is intended for this purpose. Do you have a PBX? -- Ed Crowley MVP - Exchange "Protecting the world from PSTs and brick backups!" "Microsoft Exchange 2007 command shell" <MicrosoftExchange2007commandshell@discussions.microsoft.com> wrote in message news:FAE20A61-AD17-4218-90C2-9356CA90B2A0@microsoft.com... > Is there any functionality available in exch...

Looking for Excel Help
I'm a very novice Excel user and am looking for a little help with creating a formula for a spreadsheet I'm creating for my personal use. I would appreciate some assistance if possible. Thanks in advance. Dan --- Message posted from http://www.ExcelForum.com/ Hi Dan! Post a sample of what you want to do. Your question is just a tad open ended <g> -- Regards Norman Harker MVP (Excel) Sydney, Australia njharker@optusnet.com.au Excel and Word Function Lists (Classifications, Syntax and Arguments) available free to good homes. "DanB4105" <DanB4105.ywtpa@excelfor...

New to excel
Hi All, I'm new to Excel ( and to this forum :) ) and so I hope somebody may b able to help me. I've got 2 questions.... QUESTION 1 I've got a spreadsheet which takes data from one worksheet and uses i to calculate data in a second worksheet using the following code formula: =IF('4th November 2005'!B19="","nothing here dude",IF(B19<'4th Novembe 2005'!B19,"UP",IF(B19='4th November 2005'!B19,"Same",IF(B19>'4t November 2005'!B19,"DOWN")))) The problem is, when I create a new worksheet I have...

Reporting from Project Server
I dont know if i need to ask this question here or in the Access section. I have an ODBC connection to the Project Server database so I can make reports through Access. Access' limit of 255 fields per table is causing me some trouble. for example, the MSP_VIEW_PROJ_PROJECTS_ENT table has well over 255 fields. Access only shows me the first 255 fields. how can I change that so I can see all the fields in that table? thanks, Hadi Hadi, I have not tried this yet it may be a viable option. Have your DBA create a view that pulls the key fields to this table and the specifi...

Changing Cells and entering data in them
Thanks for the help again. Big thanks to Steve you've got me this far. I went out and bought a book, but it's like reading a foreign language. I was informed today that I can't have message boxes come up. I need to have the code point at the cells and if they are blank turn which ever one is blank red or if both are then both turn red then pause for each cell to be filled in. Cell F14 "Last Name" then automatically go to Cell F16 "First Name" on tab or enter. Basically if Cell F22 or F23 has an X in it, Cells F14 an F16 turn red and cell F14 has the focus...

Excel button problem
Hi All I have a macro that copies a worksheet in the active workbook and puts it into a new workbook - then formats it and deletes any buttons on the worksheet. On the first click on the button the macro works ok. On the second click, it fails because the all assigned macros on all buttons in the active workbook changed from "mba" to "book1!mba". Book 1 doesn't exists (wasn't opened, wasn't saved, doesn't have the macros). I've never experienced this problem before?? Can anyone help to solve this problem? FYI The macro to do this is c...

Using Relative path for XML data file?
Is there a way to specify a relative path to an XML data file imported into Excel 2003? I am writing a web app that generates report data as XML for the user to download to their local machine. This data is to be consumed by an Excel reporting spreadsheet, which contains display-formatted tables and charts that are mapped to various data fields in an XML Map, which is in turn linked to the xml data file they will download. The idea is the user only needs to download the data for updates, not the whole spreadsheet. However, since I cannot predict the path where the user will store their...

Excel 97 #9
Please can anyone help??? I have two columns in Excel 97. The first contains a list of statu values eg. pending, or granted or withdrawn. The second contains date eg.01/12/1997, 05/06/2003. I woudl like to know how to get all th granted apps before 31/12/2003. Can anyone help please -- Message posted from http://www.ExcelForum.com theres many ways, but an easiest way would be to do a sort. Highlight the 2 columns, click on data, then sort, then sort by status, then by date. this should group them all together. hope this helps...toe >-----Original Message----- >Please can anyo...

RMS V2 and QSC Import
I have successfully imported several of my customers products using the QSC Import tool as a test but am unable to import the items with any association with sales tax? The default Sales Tax is TAX which is what I plan on using but once imported it creates a new item code TAX so now I have two? I plan on importing several hundred products and any help would be much appreciated. -Jess Reference- https://mbs.microsoft.com/partnersource/products/rms/downloads/releases/rms_so_importutility.htm i use the same tool but i dont tell the import utility anything about tax. import the items witho...

Reading SQL Server Extended Properties
I have an Access 2003 front-end (mdb/mde) connected to a SQL Server 2000 back-end. SQL Server 2000 offers the ability to add extended properties (such as a caption, for example) to objects (tables, columns, etc.) using a stored procedure called sp_AddExtendedProperty, along with the ability to retrieve the values of these extended properties via a function named fn_ListExtendedProperty. With fn_ListExtendedProperty, four columns can be returned/selected using a Select statement: objtype, objname, name and value. The first three columns returned are of datatype sysname, whil...

data sort
ok now should be simple >> I need to sort by month on data that is held in format >> day/month so eg 1511 1510 3011 3010 now custom/ends with/ 11... does not work custom/ends with/ ??11.. or *11 does not work either contains 11 does not work (& would also be wrong if data set contained 1011) but still I am stumped so any help would be great cheers Alex I would be inclined to add a new, temporary field of formulas that pull off the right 2 digits, and sort by that: =RIGHT(A1,2) -- Jim Rech Excel MVP ...

MS POS = RMS? Also, SQL Connectivity...
I'm new to MS Dynamics software, and I may be posting this in the wrong section - please let me know if I am. I have recently opened a retail store, and purchased MS Point of Sale to manage my POS functions. Is this software also called RMS? Is it a PART of RMS? From what I can find online, I cannot tell. Also, I'm interested in connecting to MS POS's MS SQL database with an external program (OSQL) to automate some SQL queries at the end of each day. Does anyone know what I use for the datebase name (master?), username (sa?), and password? I cannot seem to find any doc...

explanation of codes in Visual Basic when creating User form
Hi, I am trying to create a user form in Visual Basic however I'm trying to teach myself by reading/watching tutorials. (www.contectures.o.ca, etc) A lot of the instructions I am seeing simply give the code rather than explain how to actually write one from scratch. So... I need to know what each 'term' means so I can understand how the codes work. Any help is much appreciated :) One of the first codes is for the Add button Private Sub cmdAdd_Click() Dim iRow As Long Dim ws As Worksheet Set ws = Worksheets("PartsData") What d...

learning Excel #3
Hi, I was considering learning Excel as an additional tool for my data analysis work. Is it better to use data sets that I have previously used with SPSS and apply the same analysis tools as in SPSS? For applying the appropriate tools, I was considering using excel's online help. The second option I have is to use some excel book for data analysis and apply the techniques to data sets provided with the book. Any suggestions????? regards Metal ...

unable to paste Excel 2003 chart into Outlook 2003
(This was posted on "excel.charting" group.) I have a user who's unable to paste an Excel 2003 chart into Outlook 2003 email message. In Outlook options, the checkbox is selected for "Use Microsoft Office Word 2003 to edit e-mail messages". When I tested this on my own computer running the same version of Office, if the box is check, I have no problem pasting; if this box is cleared, I cannot paste. But on his computer, it doesn't work regardless. Thanks and regards, TL ...

Pulling data from separate tabs
When charting in Excel 2002 is there a way to use sets of data from two different tabs within the same worksheet? For example, a spreadsheet contains separate tabs for prior year and current year data. Is there a way to reference the data or label series to pick up data from both? I tried pointing and clicking, and then typing the following as a reference for the axis labels: ='Prior Year'!$B$110:$M$110,'Current Year'!'$B$110:$M$110 but receive an error that I'm referring to an external worksheet. I've used the comma (') in the past to reference breaks ...

How do I Remove a Split from my Comments in Excel 2003? #2
I have set my current workbook to split/freeze the first column and first 2 rows. Now, when I add a comment to the second row (in any column) my comments are cut off if I should scroll down. I don't ever remember the behavior before. And I don't know what I've done to enable it but it's really annoying. How do turn this off ? ...

How to automate increasing the form cache registry/file etc...
I want to roll out a batch file to make a number of tweaks to CRM The body of it would go REGEDIT /S Kerberosefix.reg REGEDIT /S ForceFormreload.reg REGEDIT /S OutlookFix.reg It would also rename OSA.exe to OSA.bad Remove OSA.exe From the startup menu I need help finding a way to use my batch file to increase the Outlook Form cache from the default 4MB to 50 MB.. This makes CRm more stable and faster for communications. I dont want to manually do this, as it time consuming, are my end users would not be reliable in doing it themselves. I also want to make another batch file or button that...

will CRM load on a 2003 server?
will CRM load on a 2003 server? Microsoft CRM v1.2 supports Windows 2000/2003 Server. Frank Lee Workopia, Inc. >> Other Microsoft CRM Online Forum Resources: http://www.workopia.com/Links.htm >-----Original Message----- >will CRM load on a 2003 server? >. > No problem. We just completed a 1.2 installation on a 2003 server, without any problems. Brian Demoe "Troy Hicks" <tlhicks@nc.rr.com> wrote in message news:03dd01c3dcb2$93653a00$a501280a@phx.gbl... > will CRM load on a 2003 server? CRM 1.2 will also load on Small business server 2003 as wel...

Disable Secure Sockets Layer on exchange server when using RPC over HTTP
Hi im trying to enable RPC over HTTP to enable users to establish contact to my Excahger server 2003 over the internet. Now, I dont want to use SSL (security not that important) and i am told by this article that i can disable SSL in windows registry. Quote: Note While RPC over HTTP does not require Secure Sockets Layer, you must modify the registry to enable RPC over HTTP if you do not want to use Secure Sockets Layer. Microsoft recommends that you enable and require Secure Sockets Layer for your RPC over HTTP communications. At this address: http://support.microsoft.com/?id=833401 But i ...

get a result of an sql into a field
Hi there I would like to get a result of an sql execution (ms sql server) into aq filed. example i A1 I have a ID number in A2 I would like to get the result of something like this 'select name from address where id=A1' Does this exist in Excel ? Thanks in advance Ralf Here is the sub i have written for loading an Sql Query into th worksheet. Parameters: Server Name DataBase Name SQL Command Target Sheet name Column to begin from Row to begin from ex: CALL LoadData("MyServer","MyDataBase","Select UserName fro TblNames", "QueryData"...

Excel corrupts when asking to update vlookups
We are experiencing weird behavior with some Office 2K3 Excel spreadsheets that contain lots of calculations, but no macros. On some pc’s Excel acts normally, on others you get the error. I have a couple of screen shots available. Any help is appreciated. If desired, send your file to my address below. I will only look if: 1. You send a copy of this message on an inserted sheet 2. You give me the newsgroup and the subject line 3. You send a clear explanation of what you want 4. You send before/after examples and expected results. -- Don Gu...

Uninstall of mappoint has caused errors with excel
Hi, I am running Office 2003 on the terminal server (windows 2003) and had a copy of mappoint as well. This is a mapping program. We ininstalled mappoint which has caused an error message with Excel and other office products. The error says "Cd:\documents and settings\administrator.ocrdc1\application data\microsoft\addins c:\Program files\common files\microsoft shared\geography\mpoai9.dll is not a valid add-in." I then click OK and excel opens up and everything is fine. The problem is that we are using other programs as well such as Quickbooks that export to excel and t...

Redirect Exchange 2000 IS backup to different Exchange 2003 server
I recently added an Exchange 2003 server to the same org as a 2000 server. I have dbs from the 2000 server that I need to restore to retrieve email from a user whose mailbox was moved to 2003. So I need to restore the db for that mailbox from BEFORE it was moved because when you move mailboxes you lose any deleted items that were being saved by retention policy. Is this possible? I'm using Veritas Backup Exec 10 but nothing in their support KB seems to follow this exact scenario. If it helps, the old Exch 2000 server is currently empty of users and is ready to be uninstalled. W...

how do I add error bars to a 3D chart in excel?
The help states you can only add error bars to data series in 2D area. Is there a way to add them to a 3D chart? Hi, I would not have thought so. Obviously as it is not a built-in option the only way would be a work around perhaps using dummy series. Unfortunately you can create 3d combination charts. Stick with the 2d view. Cheers Andy elahe wrote: > The help states you can only add error bars to data series in 2D area. Is > there a way to add them to a 3D chart? -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info I checked, and error bars are not offered for 3D ch...