connect SQL to SPSS - sql

I have table in Microsoft SQL server; and I'm using SPSS 14.1.
Now I want to connect SQL table to SPSS, so I can use SQL table from SPSS directly.
In SPSS, SQL database -> Data source -> Add New database connection -> Then I have 3 data source options only: dBASE Files, Excel Files, and MS Access Database. Which one can connect to SQL server?

You should open the Microsoft ODBC Administrator from Start or the Control Panel. There you should activate the System SDN tab, click Add... and add a SQL Server data source.
A wizard will open, where you can enter the details. First the name of the connection, which will be used as a reference by SPSS. Then optionally a description, and the ip address or name of the server.
On the next page select the authentication method, and if needed, enter the user and password. From this point, the default settings will most likely be good. If you will have character coding problems or something like that, you may need to change these settings.
I also use ODBC connection to connect to the database from SPSS, and it works well.
I hope this will help.

You may need an ODBC driver from MS or use one from the Data Access Pack for SPSS, but you will need a driver specifically for SQL Server.

Related

What SQL type is used in Excel

This is my first post in here,
I am new to SQL and I started learning it, I use it mainly in excel to get data from an outer Database
I first go to data then Refresh all then from the menu I choose connection properties
Then a dialogue appears and I input my code in the window called Command text from the Tab Definition
I added images to show where I input my SQL code
My question is what type of SQL do I input there ?
is it mySQL or SQLServer or what ??, so I can learn it, because some commands just don't work with me the way they are supposed to do
You can connect to any database type as long as you have the appropriate ODBC drivers. For example, here is documentation for MySQL for Excel. Quote from article "Use Microsoft Query to retrieve external data":
If the external database that you want to access is not supported by the
ODBC drivers that are installed with Microsoft Query, then you
need to obtain and install a Microsoft Office-compatible ODBC driver
from a third-party vendor, such as the manufacturer of the database.
Contact the database vendor for installation instructions.
OLAP databases do not require ODBC drivers. When you install Microsoft Query, drivers are installed for databases that were created
by using Microsoft SQL Server Analysis Services. To connect to other
OLAP databases, you need to install a data source driver and client
software.
Whichever database type you connect to, you will still be using Microsoft's SQL variant (as developed for SQL Server). As a beginner you're not going to notice too many differences right off the top. Most of the differences are related to data types, such as DATE vs DATETIME. Here is a wiki on SQL Compliance and this article on MS Access SQL will also apply to Excel Query.
You can connect to many data source including: SQL Server database, Access database, MySQL database, PostgreSQL database etc..
You can find the full list here: Link

Visio Reverse Engineer Won't Add Data Source

I have Visio 2010 Premium, and I'm trying to connect to a SQL database. I go to the Database tab, and choose Reverse Engineer. If I choose Microsoft SQL Server, there are no data sources. I choose New... and set up an ODBC connect to the server and database. It is a successful test connection. When I get back to the Reverse Engineer Wizard, it didn't add the new data source, and I can't go to Next. It says "No valid data source is specified for connection. Specify a valid data source to proceed." If I go to New... again and set it up again, it still won't add it. I tried an ODBC connection, and OLE connection, nothing works to add the Data Source.
Can anyone help?
Use the ODBC generic data source
Try using the ODBC generic data source in order to have it appear in the Data sources list:
On the first page, select Microsoft SQL Server from the drop-down list:
Click Setup, then select ODBC Driver 17 for SQL Server. Then, click OK:
Now select the New... button (right of Data sources) to create a new source.
Go through the Create New Data Source wizard (File/User/System doesn't really matter - it's just where the definition is stored), creating a new data source, making sure to select ODBC Driver 17 fo SQL Server again when prompted:
The data source will then appear in the Data sources list.
Note: System DSNs may not be modified within Visio unless running as administrator. When not running as administrator, this message will be received:
To work around this, type 'ODBC' at the start menu, and edit the System DSN from the ODBC Data Sources tool (Visio is a 32-bit image, so use the 32-bit ODBC tool):
It can also be accessed through: %windir%\syswow64\odbcad32.exe

SQL linked to Access add more tables

Ok, I am using an Access 2010 database linked to a SQL 2012 backend. All is well. I migrated using the Migration Wizard - this creates the link without using any pre-created ODBC\DSN file etc. This works great as I do not have to deploy any DSN file to users (it is used by 21 users) I have noticed that linked tables have the below in the Properties\Description:
ODBC;DRIVER=SQL Server;SERVER=XXX;Trusted_Connection=Yes;APP=Microsoft Office 2010;DATABASE=XXX;Network=DBMSSOCN;TABLE=dbo.tblCountries
Now my problem is if I create a new table in the SQL backend, how do I link without using ODBC\DSN? How do I link so it behaves the same as when migrated?
I have tried creating a table then using the description from above and changing the table name to no avail. If I do link via ODBC to the SQL backend, link to the new table then change the ODBC to match that above, Access does not let you change the connection string?
So in summary, are you able to link to new tables in SQL server, after you have used the migration wizard to link?
THanks,
Michael
The DSN connection string is actually stored with the linked table. That's why your users can connect to the linked table without needing to set up a DSN connection.
I do very similar work on a daily basis with Microsoft Access connecting to a SQL database server. I have set up ODBC connections on my development machine, which allows me to easily list the tables available on the SQL server databases, and link to them in my Access applications. When linking to the table, I always save the connection string with the table link, so the end users never need the ODBC connection.
In a sense, you can think of your ODBC connection as a template for connecting to the database. As long as you always save the connection string with the linked table, your users won't need the DSN connection to access the database.
There are times when it is appropriate to use a DSN connection, but in my experience, I find it far more practical to just save the full connection string with the linked table and manage the links using the Linked Table Manager.
Hope that helps!
Adam

Migrate Fox Pro DBF files to SQL Server 2012 x64

I have among 80 and 100 Fox Pro DBF database files that I want to migrate to MSSQL Server 2012 x64.
Because are too much DBF data bases I'm looking for an automatic/non Manual way of move all data contained in these DBF files to MSSQL Server Data base Tables. One separate table for each DBF File.
I have tried the following code:
SELECT *
FROM OPENROWSET('MSDASQL', 'Driver=Microsoft Visual FoxPro Driver;
SourceDB=F:\SomeDBFPath;
SourceType=DBF',
'SELECT * FROM someDBFFile')
in order to see/explore the data of one DBF, but the following error messages appears:
OLE DB provider "MSDASQL" for linked server "(null)" returns an error.
Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "(null)"
I'm not interesed in use external software like a DBF converter or similar tools.
At this time I have installed the AccessDatabaseEngine_X64 file located at http://www.microsoft.com/en-us/download/details.aspx?id=13255 due to previous recommedations with no success.
Thanks in advance.
Do you have access to Visual FoxPro? If so, you can via the default menu of Tools -> Wizards -> Upsizing.
First, go into Control Panel, Administrative Tools. Under that is ODBC Data Sources (should be a 32-bit version). Go into that and then go to the tab for "System DSN" and click Add button to the right. You will then be prompted to "name" the connection. For grins, something like "UpsizeMyData". It will then prompt you through the connection information to the database you are trying to connect to, user / password for connection, etc. Go through and create the ODBC connection info and make sure the "Test Connection" at the end is successful.
Once this is done, get into VFP. From the menu steps above, it will bring up a dialog window for transferring a database. It will prompt you for the database you want to upsize... pick via a "Get File" dialog. After that, it will prompt you with connection information, the ODBC connection you just created above should be listed. Select that, then "Next". It will then prompt you for the SQL password to start the connection.
Once connected, it will look though your database and look at the tables. You will have a side-by-side picker dialog of all available tables and you can pick those you want to upsize... you can do one, many or all, then click "Next".
The next dialog will show you each of the tables you've chosen and allow you to confirm the data type from the VFP table to the corresponding column data type when pushed up to SQL. You can try by letting the defaults go and try. Click "Next".
Finally it will ask you which database you want to upsize to. You can pick an existing database, OR Add a new (may be your choice for first time to see how things go).

Linking SQL 2005 tables in Access (Client file) and distributing to users

I've used the Access 2007 upsizing wizard to move my files to a SQL server. A problem I'm experiencing now is that when I try to link the tables in either Excel or Access, it requires me to create a DSN or a machine data source connection. In either case, when I do this, it makes the connection only useful on the current PC.
What I'm trying to do is create an access file and an excel file, both of which link to the newly upsized tables on the sql server, which I can distribute to users across the network (let's assume they all have sufficient user rights on the SQL server to read data).
Any suggestions?
Chuck
Use Doug Steele's code to convert your DSN's to DSN-less connect strings:
http://www.accessmvp.com/DJSteele/DSNLessLinks.html