Getting Mapping error in OLE DB Destination when use SQL Command under Data Access Mode - tsql

I am working SSIS integration using Visual Studio 2017. I have tested 'Data Access Mode' Table Or View which did work. Now I need to filter data and I am trying to use 'Data Access Mode' SQL Command and getting Mapping issue in OLE DB Destination Editor.
In Destination Data outsource, I use OLE DB Destination and under 'Component Properties' SQL Command I type following script
INSERT INTO User_Filtered
(UserGUID
,IdNum
,FirstName
,LastName
,Email
,PostCode)
VALUES
(?,?,?,?,?,?)
In mapping getting error
error
error at user dataflow [ole db destination] no column information was returned by the SQL Command
Under the OLD DB Source I typed following script under the SQL Command dataview, which seems fine
SELECT u.*
FROM [AnotherServer].[dbo].[Users] AS u
where [email] IS NOT NULL AND [org] IS NOT NULL

In the OLE DB Destination you only need to use a SELECT statement with the columns that will be inserted into, not an INSERT statement. After this you can map the columns on the Mappings page.

Related

View query used in Data Factory Copy Data operation

In Azure Data Factory, I'm doing a pretty vanilla 'Copy Data' operation. One dataset to another.
Can I view the query being used to perform the copy operation? Apparently, it's a syntax error, but I've only used drag-and-drop menus. Here's the error:
ErrorCode=SqlOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=A
database operation failed. Please search error to get more
details.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Data.SqlClient.SqlException,Message=Incorrect
syntax near the keyword 'from'.,Source=.Net SqlClient Data
Provider,SqlErrorNumber=156,Class=15,ErrorCode=-2146232060,State=1,Errors=[{Class=15,Number=156,State=1,Message=Incorrect
syntax near the keyword 'from'.,},],'
Extra context
1.Clear Schema and import Schema again.
2. This mostly happens when there are some changes to table schema after creating pipeline and datasets. verify once.
3.The schema and datasets should be refreshed when there are some changes in the SQL table schema.
4. For table name or view name used in the query, use []. ex: [dbo].[persons]
5. In datasets select table name
6. try to publish before testing.
I followed the same scenario and reproduced the same thing. I didn’t get any error as you can see, the above error mainly happens because of schema.
Source dataset:
In source dataset, I manually added and connected to SQL database with Sample SQL table.
Sink dataset:
In sink dataset, I added another SQL database with auto create table, write behavior: Upset, key column: PersonID.
Before execution there is no table on SQL database, then after the execution was successful, I got this sample output in azure SQL database.

Getting db2 error: ibm_db_dbi::ProgrammingError: The last call to execute did not produce any result set

We installed Superset in our development environment and trying to display data in reports format. Reports will be generated form DB2 Database. I am able to access reports properly and i can execute select statements without any issues.
Along with reports, we need to create few tables also. So we created a user with necessary permissions. When I tried to create a table from Superset I am getting the following error message. Same query is working fine from DBeaver (where I connected to the same database with same user name).
Any suggestions/ideas on what I can try?
db2 error:
ibm_db_dbi::ProgrammingError: The last call to execute did not produce
any result set.
Query: MSACCESS is the schema where I am creating MMR1 Table
CREATE TABLE MSACCESS.MMR1(
zip_code VARCHAR(6)
);
Below statement should create a table . Userid has necessary permissions
CREATE TABLE MSACCESS.MMR1(
zip_code VARCHAR(6)
);

On Google Data Studio, using PostgreSQL data, how do I "SELECT * ..." but for camelCase columns?

On Google Data Studio, I cannot create a chart from Postgres data if table columns are in camelCase. I have data in PostgreSQL where I want to get charts from. Integrating it as a data source works fine. Now, I have a problem when creating a chart.
After creating a chart and selecting a data source, I try to add a column, which results in this error:
Error with SQL statement: ERROR: column "columnname" does not exist Hint: Perhaps you meant to reference the column "table.columnName". Position: 8
It just so happens that all my columns are in camelCase. Is there no way around this? Surely this is a basic question that has been resolved.
When connecting to your data source, try using 'Custom query' instead of selecting a table from your database. Then manually write your SQL query where you cast your camel case column names to lower case using sql alias. Worked for me.
example:
SELECT
"camelCaseColA" as cola,
"camelCaseColB" as colb,
"camelCaseColC" as colc
FROM
tableName as table

How to View Execution Plan for Query Containing a Temp Table in Toad for SQL Server?

I am trying to tune the performance of a stored procedure that contains a temp table in Toad for SQL Server. After selecting "Include Actual Execution Plan" from the 'Editor' menu, I run the query. The Results Set returns values as expected, however, the Execution Plan tab shows the following error:
Invalid object name '#temp'.
I have tried creating the temp tables first then just executing the SELECT statement that references it, I tried creating the temp tables as global temp tables and running the SELECT statement in another window, and I have messed with the SHOWPLAN_TEXT and STATISTICS PROFILE (as mentioned in this question) but I keep receiving the same error. The only thing I have not tried is using a table variable, but the changes I will be making cannot be done on table variables, so this is not really an option for me at this time.
Has anyone else come across this or have any ideas as to what I might be doing wrong?
You'll want to use the ISQL command line utility on a machine that has SQL Server client package installed. Or any other utility that can submit a query to SQL Server.
ISQL Docs and How to get an execution plan (2nd part of the post)

Two procedures with same name & select types but EF complains about incompatible data reader

I have two same procedures in two DB, by same I mean:
Same name
Same parameters name & type
End with a select returning same columns types & names (If I put a SELECT ... INTO table it generates the exactly same table).
The only thing which differs is the code building the sql query for the final select.
If I use EF on Database 1 it works as intended, but if I run the code on Database 2 it ends on error:
The data reader is incompatible with the specified 'Ctx.Procedure_Result'. A member of the type, 'FooId', does not have a corresponding column in the data reader with the same name.
I'm using:
Entity Framework 4.2
Visual Studio 2010
Sql Server 2008 R2
I don't have enough knowledge of EF internals to understand why this is happening.
My idea is that there must be some columns types/names sniffing mecanism which doesn't sniff the same stuff.
Edit 1:
The procedure doesn't "return" a table type it just "select" some rows.
This select result is mapped to a ComplexType in the EDMX.
Feel free to ask for more details.
My fault, as suggested I traced the EF queries with SQL Server Profiler.
In fact EF was using NULL in an optional parameter which destroyed the sql query inside the procedure ('select ... ' + NULL => NULL).
With a NULL query the procedure select no column at all and it crashes the EF data reader.