John Smith001


I have the following SQL statement in the DataReader.SQLCommand.

select * from myTable where DataEdited > 'some hard coded date data'

I want to read the above 'some hard coded date data' from a table sitting in different database which is not the same server where the DataReader is connected.

How to do that

I can populate the 'some hard coded date data' to a SSIS variable but do not know how to embed that in the SQL statement.

Thank you for your thoughts.

Smith





Re: SQL Command Datareader

Phil Brammer


Do you need to use the DataReader






Re: SQL Command Datareader

Marlon Grech

Create another connection to the other database, read the data you need and generate the sql dynamically... I don't think that you can do this on the same reader since a reader always has one connection ...






Re: SQL Command Datareader

John Smith001

My requirement is to suck the data from Oracle 10g and load into SQL Server 2000 database.

DatareaderSource to OLEDBDestination.

Any other reader is fine as long I am able to get data from Oracle 10 g.

Thank you for the quick response.

Smith






Re: SQL Command Datareader

Phil Brammer

Download the OLE DB for Oracle driver and install that. Then use the OLE DB Source component, of which you can use a variable as the SQL Source.

http://www.oracle.com/technology/tech/windows/ole_db/index.html







Re: SQL Command Datareader

John Smith001

I can have another connection and generate the SQL dynamically. But, How you will attach the dynamically created SQL statement to the DataReader.SQLCommand

Smith






Re: SQL Command Datareader

Phil Brammer

John Smith001 wrote:

I can have another connection and generate the SQL dynamically. But, How you will attach the dynamically created SQL statement to the DataReader.SQLCommand

Smith



I'm talking about getting rid of the DataReader source and replacing it with an OLE DB Source component. It will be much more flexible for you, and likely better performing.





Re: SQL Command Datareader

Rafael Salas

The SQL command of a data reader can be set via expression. Go to the control flow, select the data flow and then look at the expressions property.

BTW, I would use an execute sql task to get the date value you wan t to replace in the sql command inside of a SSIS variable; then use it in the sql command expression.






Re: SQL Command Datareader

John Smith001

Thank you all for the quick reply.

Your answers helped me to solve the problem.

Smith






Re: SQL Command Datareader

Rafael Salas

Would you tell a little more about your solution and marked the answers that help you. That makes this forum a better place.

Thanks