A group in my company granted me access to execute a stored procedure, and the stored procedure, if executed from excel, gives me a table. I want to store this table in SQL via SSIS.
I tried this via:
Within DFT, I created a connection using SQL Server Native Client. And within source assissstant, I entered SQL command
EXEC [dbname].[storedprocedure]
But then it returns an error:
No column information was returned by the SQL command.
Is there anyway to make this work?
Add the proper data source and then connect it to the OLE DB Command. Under the Connection Manager tab, setup your connection. Under the Component Properties Tab in the SqlCommand line enter EXEC [Stored Procedure Name] ? use as many ?s for as many variables declared in your Stored Procedure. Under the Column Mappings tab you will map your variables from the Stored Procedure to the relevant columns in your SQL Server DB.
Related
My ADF pipeline processes through many imput files and lands them on an ABS container.
A 3rd party stored proc has two params: filename and datasourcelocation and does a bulk insert into an Azure SQL DB.
For the Data Source Location I pass: landing/Vendor
For the Data File /Company_05_17_22_05_54.csv
The full ABS location is for a single file is: https://...use2dev01.blob.core.windows.net/landing/Vendor/Company_05_17_22_05_54.csv
The error message says
Execution fail against sql server. Sql error number: 12703. Error Message: Referenced external data source "landing/vendor" not found.
How should I be passing the ABS location to the proc?
The error message says
Execution fail against sql server. Sql error number: 12703. Error Message: Referenced external data source "landing/vendor" not found.
For this error you can create a new data source (eg myazureblobstorage1 and provided that name in the second BULK command)
Try to Check the TLS version of the storage account. sometimes TLS settings may cause this error
Try to create the external data source ,wait for mins before running the BULK Insert
Check the CSV file is formatted properly, it may cause other issues
Take a note of additional parameters in the BULK Insert command
Make sure Table column names must match with that of CSV file
If you want to bulk insert from Azure blob, please refer to following script of so thread
Please check if the data source exists , You can verify the name of the data source by querying sys.external_data_sources and referring this MsDoc
For more in detail, please refer below links:
Bulk insert from Azure blob storage to Azure SQL database
SQL Server BULK INSERT does not work with Azure Blob Storage emulator
https://learn.microsoft.com/en-us/azure/data-factory/quickstart-create-data-factory-portal
I am working on an existing SSIS package to add custom logging to it. I am trying to test it, and I have an Execute SQL Task that I didn't create that is getting the following error.
Executing the query
"ap_pfl_DropProfileTables"
failed with the following error:
"Could not find stored procedure 'ap_pfl_DropProfileTables'.".
Possible failure reasons: Problems with the query, "ResultSet"
property not set correctly, parameters not set correctly, or
connection not established correctly.
I have no idea why I'm getting this error because:
I didn't create this or change it and this package is running without error in production.
The stored proc just truncates two tables. It doesn't have a result set or parameters.
The connections are working properly because this stored proc runs at the same time as another thread running a data flow task which runs successfully and uses the only two connections in this package.
I've double and triple checked the database to make sure the stored procedure is there and spelled correctly. I even checked the case of the letters in the stored procedure.
Any ideas on how to fix this?
I know this is an old thread but I have just run into this issue when using SSIS on SQL 2008 R2.
For me with an ADO.NET connection, I actually had to set IsQueryStoredProcedure to False and then the error went away. It didn't matter whether I used EXEC or not.
Yes this is frustrating - but Do-able. The key is to NOT use ADO.NET connection manager but instead use the good old fashioned ADO connection manager. The 2nd key is to NOT use EXEC or EXECUTE in the SQLStatement property of the Execute SQL Task editor. Just type in the name of the stored procedure (also for good measure use the 3-part name convention database.schema.storedprocedure. )
I haven't tried this with params on the stored procedure. Also, I have not tried this with the OLE DB connection manager.
I ran into this myself, and here is what I did (with the ADO.NET connection)
In the SQLStatement field I put the name of my stored procedure (dbo.myStoredProc).
I then set the IsQueryStoredProcedure property to "True"
I'm thinking that when IsQueryStoredProcedure is set to true the object automatically prepends EXEC to identify that the command is a stored procedure call.
After having the same issue I did some investigation on this:
Specifically my situation is:
I need to use ADO.Net because I am running against SQL Azure
I want to capture the stored procedure return value
First I tried this:
In SQLStatement I put the proc name (without EXEC)
myschema.MyProc;
In IsQueryStoredProcedure I put False
In ResultSet I put None
In the Parameter Mapping tab I put
Variable Name Direction Data Type Parameter Name Parameter Size
User::MyVariable ReturnValue Int32 0 -1
This runs without error, but does not capture the return value.
I assume if you set IsQueryStoredProcedure to true, it should wire all this up properly. But it returns an error instead.
This https://technet.microsoft.com/en-us/library/cc280502(v=sql.110).aspx, says for capturing the return value when using ADO.Net"Set IsQueryStoreProcedure is set to True". But it returns the error that is the OP
As a workaround I did this:
DECLARE #R INT
EXEC #R = MySchema.MyProc;
SELECT #R
I left IsQueryStoredProcedure as False
I set ResultSet to singlerow
I removed the parameter mappings and instead mapped a resultset:
Result Name Variable Name
0 User::MyVariable
I have installed vfpoledb I am running it against VFP 8 tables. When I execute the command
connection = SQLSTRINGCONNECT([Provider=vfpoledb;Data Source=C:\temp\;Collating Sequence=general;])
I get a popup dialog with SELECT DATA SOURCE
I am trying to use the connection string specified here http://www.connectionstrings.com/visual-foxpro#89 where I want access to free tables using OLEDB. I can connect using an ODBC connection string.
Am I using it correctly?
You don't specify the language you are trying to build against. Here's another link of an instance using OleDB to connect to VFP Tables
It may not be a perfect match, but does show how to properly create an OleDB connection to the path where the VFP data exists, and perform a SQL-Insert using parameterized queries (prevent sql injection), and attempting to pack/delete from too.
Once you get the basic connection down, and basics on parameterizing queries, your queries can be like almost any other VFP SQL-Select, Update, Delete query.
From within Foxpro you need to use the ADODB connector:
oConn = CREATEOBJECT("ADODB.Connection")
oConn.ConnectionString = "Provider=VFPOLEDB.1;Data Source=C:\temp\;Password="";Collating Sequence=MACHINE;"
I'm using VFPOLEDB to connect to an VFP database (directory of dbf files).
Once connected, I manually create a table using:
create dbf critera(field_name c(30))
At this point, I verify a new dbf file is created in the database directory. I then try to query the new table, it should return no rows.
select * from criteria
I am presented with the following error:
File "criteria.dbf" does not exit.
Strange, eh?
So I manually delete the DBF file (VFPOLEDB doesn't support drop) and then run the following query.
create db criteria(field_name c(30)); select * from criteria
And get no error, no results returned as expected.
What gives? Any suggestions?
First, (could be a type-o), you had
create dbf Critera (missing the "i")
and then
select * from Criteria (has the "i")
If not that... for your connection string, are you just connecting to the PATH that the .dbf files will be located, or are you explicitly connecting to a path and database.
If just a path
string YourVFPConnectionString =
"Provider=VFPOLEDB.1;Data Source=c:\\SomePath\\WhereDataIs\\";
Or with a specific database container
string YourVFPConnectionString =
"Provider=VFPOLEDB.1;Data Source=c:\\SomePath\\WhereDataIs\\YourDatabase.dbc";
It might be easier to test just by pointing to the directory. The VFP OleDB provider will consider the path the root for any tables queried vs a full .dbc (database container) which could give you access to other stored procedures and such.
The OleDb doesn't support "DROP TABLE". You can still delete a file by running an ERASE "Criteria.dbf" via the OleDbCommand's ExecuteNonQuery()
As for the last one, VFP doesn't utilize the ";" as a break between statements like other SQL engines do where you could send a series of queries all together one after another. ";" in VFP is considered a "this command continues on the next line", and should have thrown an exception is it wouldn't have been able to process it.
I would like to test a DB2 stored procedure running on an AS400 system.
I have the IBM System i Access for Windows installed and can run SQL commands against the DB2 database.
My question is: What is the syntax to execute a stored procedure that takes in a parameter and returns a result as an output parameter and print the value to the screen?
Just to clarify: I am not asking how to call the proc in code. I want to execute the proc and see the results in the gui tool (which is similar to SQL Enterprise Manager).
use the keyword call and pass in the parameters.
call myStoredProc(parm1, parm2, ?);
for more details see here http://www.ibm.com/developerworks/data/library/techarticle/dm-0503melnyk/. The interesting part is Figure 5. Using the Command Editor to call an SQL procedure
What you want is possible. I have done it myself many times. Unfortunaly, I'm not at the office right now so it must be from the top of my head.
Start System i Access
Go to your iSeries icons and log on to the one where your stored procedure lives
Go to the databases icons and connect to the correct one (you've one local and probably one or more remotes)
Only then, you will see the option "run SQL script" at the bottom of your screen
Start that option and you will see a SQL editor (editor on top, viewer/messages at the bottom)
Remember that you are already connected to the correct iSeries but your JDBC request will get the *LIBL of the userprofile of your connection. Therefore you must know the schema (iseries library) of your stored procedure
Enter "call YOURSCHEMA.YOURSTOREDPROCEDURE(?,?);" and use the menu or shortcut to run that statement. Notice that - depending on your JDBC settings (see menu) - the correct syntax may be "/" instead of ".". Also, notice that you can replace the first question mark with a value.
On an additional note,
In iAccess, under every schema you will see icons for the tables, views and so on. Also an icon for stored procedures is available. You will see your SP there. Use the options to see the definition and so. This information includes detailed information about the parameters
If you want to check that on your iSeries, use the system catalog (this can be done from the SQL editor too) with "select * from qsys2.sysprocedures where procedure_name (sorry, not sure about the name of this column right now) = 'YOURSTOREDPROCEDURE';"
VERY IMPORTANT: I was never able to test the SP with the SQL editor (STRSQL) on the iSeries itself. Only the iAccess SQL editor did work correctly.
You should be able to run your SP like this:
DECLARE
usr_in YOUR_TABLE.YOUR_COLM%TYPE; --Gets the correct type by looking at column type
app_in YOUR_TABLE.YOUR_OTHER_COLM%TYPE;
BEGIN
usr_in:='some value';
app_in:='another_value';
YOUR_SP_NAME(usr_in, app_in);
END;
Or you can use EXECUTE, but it can't be dynamically prepared (not run in Java) and I think there's some other disadvantages.
EXECUTE myStoredProc(parm1, parm2, ?);