Move Image column from OracleDB top SQL Server - sql-server

I have access to an Oracle database and I need to bring its data into SQL Server. The table has a simple structure and I can't change anything on the Oracle side.
I created a linked server inside SQL Server but I can't select the table because of this error :
The OLE DB provider "OraOLEDB.Oracle" for linked server supplied inconsistent metadata for a column. The column (compile-time ordinal 1) of object was reported to have a "DBCOLUMNFLAGS_ISFIXEDLENGTH" of 16 at compile time and 0 at run time
The OLE DB provider "OraOLEDB.Oracle" for linked server supplied inconsistent metadata for a column. The column (compile-time ordinal 1) of object was reported to have a "DBCOLUMNFLAGS_ISFIXEDLENGTH" of 16 at compile time and 0 at run time
I checked and it seems to be a general problem and Oracle suggested using OPENQUERY to get data from these tables.
When I use OPENQUERY the IMAGE ( 'BFILE' ) column is null but I can see in SQL Developer that it is not null.
When I use SSIS, I get this error:
ADO NET Source [33]] Error: The error "ORA-00972: identifier is too long occurred while processing "ADO NET Source.Outputs[ADO NET Source Output].Columns[IMAGE]
Any ideas on how to move a table with an IMAGE (BFILE) column from Oracle database to SQL Server?

Related

Cannot fetch a rows from oracle (linked server) using openquery in sql server

I am rewriting a replication package between oracle and sql server. Currently the data is moved by ssis packages, but we move towards stored procedures because of better performance and easier maintenance.
I get the following error when I try to fetch rows from oracle using openquery in sql server.
""OLE DB provider "MSDASQL" for linked server "" returned message "[oracle_db_name][ODBC 64bit driver][OpenAccess SDK SQL Engine]Failed to retrieve data. Error ticket# kkfiquod1il1svbg21nxw[401]".
OLE DB provider "MSDASQL" for linked server "" returned message "[oracle_db_name][ODBC 64bit driver]Error in row.".
Msg 7330, Level 16, State 2, Line 2
Cannot fetch a row from OLE DB provider "MSDASQL" for linked server "".""
The column that is causing the issue is an ntext column in oracle, I have tried to cast it in many ways, nothing.
Interestingly if I use LEFT(NVL(Column_Name, ''''), 4000) on the problematic column it returns some rows - the first 100 - or it returns lot more if I order my results by the id, but I can not get all.
When I located the 'last' id from the batch that did not fail and selected the next id's row the column was null just as some of the previous rows.
Is anyone ever experienced similar or have a solution for this issue?
Thanks in advance!

Transfer SQL Server Objects Task Error: Execution failed with the following error: "Invalid column name"

I am using Transfer SQL Server Objects Task in SSIS to create a package for copying procedures from prod to dev.
[Transfer SQL Server Objects Task] Error: Execution failed with the following error: "Invalid column name XYZ"
Any help on the above error will be appreciated.
Raghu
SQL Server Objects Task properties Screenshots
The error is thrown because you are trying to copy a stored procedure that is using the column XYZ from a Table, and this table is not copied or not found in the destination database.
Also From the screenshots, you are not copying Tables from the Source Database. ('CopyAllTables` property is False) , So make sure you choose all related tables to the stored procedure to be copied to the destination database

No column information was returned by the SQL command. SSDT

I'm attempting to create an update query in SSDT. I'm getting
Unable to parse query text.
The query is:
UPDATE CustOrderWithDisp
SET YARDS = CustOrderWithDisp.QUANTITY * Lkp_TestCodes.[Test_GALS] * 0.00495113
FROM CustOrderWithDisp
INNER JOIN Lkp_TestCodes
ON CustOrderWithDisp.TEST_CODE = Lkp_TestCodes.[SVC CODE]
But if I actually run the query, it works.
I want to use this query in an SSIS package. When I put this query in an OLEDB Source, i get...
The component reported the following warnings:
Error at qry03_CalculateYards [OLE DB Source [33]]: No column information was returned by the SQL command.
I'm a novice at this, so be gentle. Your help is greatly appreciated!
Error at qry03_CalculateYards [OLE DB Source [33]]: No column information was returned by the SQL command.
You are receiving this message because OLEDB Source is a DataFlow Task component, it is used to read data from an Table or SQL Command through an OLEDB Connection.
The OLE DB source extracts data from a variety of OLE DB-compliant relational databases by using a database table, a view, or an SQL command. For example, the OLE DB source can extract data from tables in Microsoft Office Access or SQL Server databases.
You don't have to put this query in an OLEDB Source, you have to use an Execute SQL Task and write this query in the SQL Command property.
For UPDATE queries you have to use Execute SQL Task (in the Control Flow level, no in the DataFlow)
The Execute SQL task runs SQL statements or stored procedures from a package. The task can contain either a single SQL statement or multiple SQL statements that run sequentially.
References
Execute SQL Task
OLEDB Source

Cannot connect to MS Access file from SQL Server 2008

I have been trying for the past week or so to import data programmatically to a SQL Server 2008 table from a Microsoft Access .mdb file. I have been getting nothing but errors, and solving one just reveals another. I made the file into a linked server, and now when I try to query it with:
Select * from OPENQUERY(Importdata, 'Select * from [IMBPieceBC]')
I get the error:
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "Importdata" returned message "Cannot open database ''. It may not be a database that your application recognizes, or the file may be corrupt.".
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "Importdata".
I've read several suggestions to relink dlls in the registry, but I've done that, and I'm still getting the error. Is there anything else I can do to fix it, or at least figure out what is wrong?
Migrating the data to a SQL Server instance is not an option. The mdb files are generated by a third-party program, so there's nothing we can do about it.
I have a similar situation at my workplace - a third party application that maintains data in MDBs, but other applications needing access to it. How I've done it is that this 'intermediary' application has links to the SQL Server tables and the MDB tables. You could use either a query or a VBA written form event to transfer information from the MDB table(s) involved into your corresponding SQL Server tables using a INSERT INTO query, fitted with a SELECT FROM subquery providing the values being inserted.

Linked SQL Server database giving "inconsistent metadata" error

I am currently running a third-party software suite, which uses SQL Server as its database. I have a second instance of SQL Server running in a different location, and some apps that I am building in that instance SQL Server needs to access some data in the third-party software. So, I created an ODBC connection between the boxes, and set up the third-party SQL server as a linked server on my version of SQL Server. As a test, I ran something like the following statement from my SQL server, accessing one of the third-party's tables:
SELECT * FROM LinkedServerName.SchemaName.dbo.TableName
To which I recieved this error:
OLE DB error trace [Non-interface error: Column 'TableRowVersion' (compile-time
ordinal 4) of object '"SchemaName"."dbo"."TableName"' was reported to have a
DBCOLUMNFLAGS_ISROWVER of 0 at compile time and 512 at run time].
Msg 7356, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' supplied inconsistent metadata for a column. Metadata
information was changed at execution time.
This error is the same for any other table I try to access. What does this error mean, and is there a way around it?
I've had this happen a few times. The one workaround I found was to use OPENQUERY.
SELECT * FROM OPENQUERY(LinkedServerName, 'SELECT * FROM DBName.Schema.Table')
Also, the select you posted above has an incorrect 4 part name (could just be a typo but I wasn't sure). It should be LinkedServerName.DBName.SchemaName.TableName
Server: Msg 7356, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' supplied inconsistent metadata for a column.
Metadata information was changed at execution time.
If you use a four-part name syntax to query the data from the linked server database, you may receive this error message. To work around this problem, you can use the OPENQUERY syntax to query the data from the linked server database. You can turn on trace flag 7300 to receive more detailed information about this error message. To turn on trace flag 7300, run the following Transact-SQL statement:
DBCC TRACEON(7300)
I solved this with these steps:
1) Step 1:
• In SQL Server Management Studio open Linked Servers and then 'New Linked Server'.
• Inside of appeared wizard – Select the General tab.
• Specify alias name in "Linked server" field.
• Select SQL Native Client as provider.
• Add sql_server in "Product Name" field (that's the magic).
• In Data Source – specify name of the host to be used as linked server.
2) Step 2:
• In Security tab – specify proper security options (e.g. security context)
3) Step 3:
• In Server Options tab – put "Data Access", RPC, "Rpc Out" and "Use Remote Collation" to be true.
4) Step 4:
• Enjoy.
http://alexpinsker.blogspot.com.br/2007/08/how-to-give-alias-to-sql-linked-server.html

Resources