How to use Excel Power Query to access a postgresql database - excel

We have a postgresql 9.0 database which we want to connect to via Excel 2010 running the Power Query plugin. I've setup the machine running excel to be able to use Npgsql to do the connection according to these instructions http://office.microsoft.com/en-us/excel-help/connect-to-a-postgresql-database-HA104028095.aspx?CTT=5&origin=HA104003952. The connection fails in Excel with this error message:
DataSource.Error: PostgreSQL: ERROR: 42883: function
concat(information_schema.character_data, unknown) does not exist
Details: Message=ERROR: 42883:..., ErrorCode=-2147467259
Has anyone successfully connected to a postgresql database from Excel using the Power Query plugin? There's a menu item on the power query ribbon in excel specifically for postgresql so I figured it would work. The concat function isn't in our postgresql version of 9.0 so do I have to upgrade our postgresql database to do this?

You can either upgrade or define your own function like this:
CREATE OR REPLACE concat(information_schema.character_data, varchar)
RETURNS varchar LANGUAGE SQL AS
$$ SELECT $1::varchar || $2; $$;
But upgrading to 9.1 seems likely the best approach.

Related

Cannot view object schema Azure Datawarehouse

Attempting to view the a view or procedure:
from SQL Server Management Studio 17.4 in Azure SQL Datawarehouse notes the error:
I can however, delete and create any object that I want.
How can I work to ensure I can view the objects definition?
UPDATED
Concerning setting the options in SSMS to SQL Datawarehouse, there is not that option:
Please change this setting under Tools... Options. That should resolve the error. I wish we didn't have to change this but at lease we have a workaround.
In SSMS 17.5 there are a few more options. You can have it automatically detect what type of database you're connected to and script accordingly. Or you can force it to script for a particular database type like the following screenshot.
It appears there is a bug in certain versions of SSMS (such as 17.5) where if the DW user isn't also a user in the master database then scripting fails. The easy fix for this is having the server admin connect to the master database and run:
CREATE USER MyUserNameHere FROM LOGIN MyUserNameHere;
Sorry you're seeing this. I've been able to repro this on SSMS 17.4 and 17.5. We are looking at this now.
This seems to be a defect in the upgrade path for 17.5 as this should be supported without having to change the script settings. We are investigating this and will try to get an update out as soon as possible.

VBA, Query Vertica database and populate to excel

I query a vertica database (using squirrel-sql tool). Is this possible to be done in excel and populate into a worksheet?
Does anyone have a possible solution for this?
Can't find anything about this online.
I have the driver location, host name, port name, user/pass.
Thanks.
You can query Vertica directly from excel. I did it and it works, just download ODBC driver, install driver, setup DNS and follow to instructions.
For version 7.x, read here
UPDATE on comment
Full documentation: Installing the Client Drivers and Tools on Windows
Download Windows Client Drivers from here. Excel require ODBC drivers.
Install drivers(double click on exe file -> next -> next -> profit!!).
Set up ODBC DNS, instructions are here
Follow to instructions here
profit!

Cannot connect to Azure SQL Data Warehouse database-error "Incorrect syntax near 'ANSI_NULLS'"

I could successfully deliver the new Azure SQL Data Warehouse database.
If Í try to connect to the SQL Data Warehouse Database, I receive following error message:
"Parse error at line: 1 ,column: 5: Incorrect syntax near 'ANSI_NULLS'".
This happens in VS 2013 and VS 2015! The data load process with BCP to the SQL Data Warehouse database was successfully!
Thanks, Herbert
Azure SQL Data Warehouse does not currently support setting ANSI_NULLS on (SET ANSI_NULL ON). You can simply remove that statement from your query and you should have success.
Additionally, make sure that you are running the June 2015 Preview of SSDT (http://blogs.msdn.com/b/ssdt/archive/2015/06/24/ssdt-june-2015-preview.aspx). This has the supported SSDT capabilities for SQL Data Warehouse.
I had the same error, when tried to Use Visual Studio to query Azure SQL Data Warehouse 
 and selected my database.
The Workaround was to select master database, connect to it, then in top drop-down for the query change to my database.
I think your connection isn't actually recognised as a SQL DW connection. I bet your query window is a .sql file, not a .dsql as it needs to be. If you connect as a .sql query, it will try to set various settings that aren't supported.
Go back into the Azure portal and use the link to connect using SSDT from there. You should get a connection in the SQL Server Explorer pane which looks different, and when you start a New Query based on it, you should get a .dsql window, not a .sql one.

Query excel based database from SQLDeveloper

I am on a Windows 7 machine and have configured a ODBC connection by name of 'MyExcelDb' to an excel file. I am able to programatically connect to 'MyExcelDb' using type-1 jdbc driver and everything is working fine.
I now want to use Oracle SQLDveloper to query the DSN 'MyExcelDb' but I am not able to make this connection as I do not find any option for ODBC Connection. I have tried using the 'advanced' option in Oracle section and tried putting custom jdbc URL as 'jdbc:odbc:excelDB' bugt to no avail.
I have tried adding entries in SQLDeveloper for third party drivers like:
- sourceforge.net/projects/xlsql/
- code.google.com/p/sqlsheet/
- hxtt.com/excel.html
Despite this but no new connection option would appear and I am still struggling to make connection between the two.
I have searched around and found that I could install Oracle and add a TNS for the excel and that way I may be able to connect using the Oracle TNS in SQLDeveloper. Installing Oracle database but would be like killing a mosquito using a canon.
I wonder if there is a simple solution to my problem.
Have you tried following Oracle's guidelines for connecting to Excel files? Did you set up a system DSN as described in step three of the Oracle guide. Importing files into the database is routine and simple but using SQL Developer in the manner you describe, without the client installed. Here is an example of reading an Excel file via PL/SQL.
My question is why use SQL Developer to manipulate a datastore in Excel when Excel is designed to manipulate the data?

How to import data via post deployment script from SQL Server CE into a SQL Server DB freshly created using VS database project

I'm trying to import data from a SQL Server Compact (.sdf) database into a SQL Server database created through Visual Studio database project.
The .sdf database was created by a third party tool from an existant SQL Server database, and it is embedded into the Visual Studio project. The purpose is to deploy the database and insert initial values on a remote machine. I would like to run the import script as a post deployment script something like the following:
INSERT INTO Employer(
EmployerId,
EmployeeName
) SELECT
EmployerId,
EmployeeName
FROM sdfDB.dbo.Employer
Is it possible to reference a SQL Server Compact database (sdfDB)
in T-SQL script?
If not, what is the best practice to import data
into a freshly created DB from an embedded datasource which can be
deployed by build script in a remote machine?
1) Is it possible to reference a SQL Server Compact database (sdfDB) in
T-SQL script?
If you are thinking to something like this,
INSERT INTO [SQL SERVER Db].Table (Values)
SELECT (Values)
FROM [Sql Server Compact Db].Table
unfortunately no, this is not possible.
2) If not, what is the best practice to import data into a freshly
created DB from an embedded datasource which can be deployed by build
script in a remote machine.
You can use the SQL Server Compact Toolbox, that contains features to generate scripts from a Sql server compact file, that you can use to populate the SqlServer database.
Features:
Script!
Migrate a SQL Server Compact database directly to SQL Server (LocalDB/Express)
Migrate from SQL Server Compact to SQL Server, SQL Azure and SQLite via script (...)
(...)
EDIT
Also available in api form at exportsqlce.codeplex.com. Thanks ErikEJ for comment and great job!

Resources