Page 1 of 1

select only new records (ODBC stage)

Posted: Mon Apr 11, 2005 5:31 am
by Luk
Hi all!

I must select from sources only new records. In my source I have timestamps (MSSQL server binary8 timestamps). I'm using job parameter telling me what is the last number of previously loaded record and in transformer I'm rejecting old ones.

I'm wondering - is there some way to use this jobparmeter in ODBC stage to select there only new records??
Or is there another way to take from source only new records when we hav e timestamping in database and information (i.e. from file) what was the last row number previously loaded??

Posted: Mon Apr 11, 2005 5:34 am
by ray.wurlod
You can use job parameters for constants in the WHERE clause of the SELECT statement.
Fill in the WHERE clause, without the word WHERE, on the Selection tab of the ODBC stage Output links properties.

Posted: Mon Apr 11, 2005 6:17 am
by Luk
You can use job parameters for constants in the WHERE clause of the SELECT statement.
Fill in the WHERE clause, without the word WHERE, on the Selection tab of the ODBC stage Output links properties.
OK ray, but how (in what form) must I write job parameter ??

for example : I have parameter xxx - what is the proper form for ODBC stage WHERE clause window ??

Posted: Mon Apr 11, 2005 6:20 am
by Sainath.Srinivasan
Under selection, you need to include

Table_TimeStamp >= #Last_Run_Control_TimeStamp#

As a good practice, you can also include the upper bound so the next run will carry from there.

Posted: Mon Apr 11, 2005 6:26 am
by Luk
thanks!!
now I know taht job parameter must be between '#' characters

Posted: Mon Apr 11, 2005 6:29 am
by Luk
one more quick question:

is there (in DS) possibility to apply to job parameter value from (for example) file??

Posted: Mon Apr 11, 2005 6:43 am
by Sainath.Srinivasan
If you wish to take the value of a parameter from a file, you need to first write some code to read the file and store the value(s) in the corresponding parameters. You can search for posts in the forum that can guide you through this.