Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Data Reader Source

Author  Topic 

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2009-10-09 : 10:01:50
Dear All,
I am new to SSIS,i do need to change the Data reader SQLCommand property.

Here I am doing simple select statement with where condition from the table in data source reader as a data source and to Excel file as destination.
I am using this query in the data reader source in sqlcommand
select * from empoyee where jdate='2009-10-09'

The problem here is every month when this get executed i need to modify the query in solution.How do i change this without modifying the package.

Pls suggest.

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-10-09 : 11:01:47
you can use

convert(varchar(10),getdate(),120)

It will give the current date in 'yyyy-mm-dd' format ...I assume thats what you need?
Go to Top of Page

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2009-10-09 : 11:06:32
Hi
My Issue is with the not the date format.I do need to change the date outside of the development environment. I guess XML configuration allows this.I am not sure if somebody helps it will be great.
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-10-09 : 11:27:39
Ok...you can assign a variable within the package to hold the value for the 'date'.

You can create a config file for your package...and include this variable in the config file.

When you run your package...you can change the value in the config file alone and execute it.

Here's a link on how to create config files.

http://vyaskn.tripod.com/sql_server_2005_making_ssis_packages_portable.htm
Go to Top of Page

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2009-10-09 : 11:37:21
Yes whatever the post you have posted well written.My Question here is When i use the following select statement in data Reader Source SQL command i am getting the error.
Select * from Employeee where jdate=?
I have created the one variable for this and initial value is stored.
I am getting this error psl help.

[DataReader Source [113]] Error: System.Data.SqlClient.SqlException: Incorrect syntax near '?'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.SqlServer.Dts.Pipeline.DataReaderSourceAdapter.PreExecute() at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPreExecute(IDTSManagedComponentWrapper90 wrapper)
Go to Top of Page
   

- Advertisement -