Thursday, February 3, 2011

DS - Lookup Q

When performing a sparse or normal lookup in a parallel job how do you return multiple rows?  
For a sparse lookup all matching rows are returned by default. There is no way to change this and any rows matching the key values will be returned.

For a normal lookup you will need to specify this option:
Right click the lookup stage and click Properties then click the Constraints icon

Select the drop-down list called "return multiple rows from link"

This list will give you all reference links but only one can be used to return multiple rows. 

******************************
Datastage server7.5 installed on Unix machine. need to have a DSN to connect to the database which is on some other unix machine.
let me know it is enough if we create a DSN at the client machine or do we have to change the config file in UNIX?
In UNIX, three files need to be configured.
a) uvodbc.config
b) odbc.ini
c) dsenv
a)uvodbc.config : Here you need to specify the name of data spurce(DSN). Existing configurations in the file can be referred to create new DSN.
For example :
<DSN>
DBMSTYPE = ODBC

b)odbc.ini : Here you need to provide the configuration details of the DSN created in uvodbc.config. The name of data source should be same in uvodbc.config and odbc.ini here the details like like driver location, database name, ip, user id, etc are specified.
Refer the exsting configurations in this file to create new ones.

c)dsenv : It contains the Environment variables needed by the ODBC drivers to connect to the ODBC data source.You need to setup certain env variables to connect to the ODBC data source.
For example :
# Oracle 8i
    ORACLE_HOME=/space/oracle8i
    ORAHOME=/space/oracle8i
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib:$ORACLE_HOME/rdbms/lib;export LD_LIBRARY_PATH
    ORACLE_SID=WSMK5
    ORASID=WSMK5
    export ORACLE_HOME ORAHOME ORACLE_SID ORASID


write a querry to count the goods sold on hourly basis

Select Count(*) DATEPART ( hh sellgoodsdate) From goodssellGroup By DATEPART ( hh sellgoodsdate)

********************

How can I convert a varchar data type into a numeric data type then insert it into a varchar field in a datatabase.

For example, I need to clean up the leading zeros of this string "00000000000009700477" then insert it into a field with charvar data type.

Note that I cannot change the charvar data type to integer or numeric data type in the target table.
Example:
Source (flat file) leading zeros in numeric Data ---> Taget table: dont want leading zeros in varchar field.
00000000000009700477 want to see only 9700477
00000000000000000890 want to see only 890
Is there an interger convert function that can be used in transformer to accomplist this task?
---------
IF LEN(Trim(DSLink9.Field001[159,4],"0",&qu ot;L")) = 0 THEN 0 ELSE Trim(DSLink9.Field001[159,4],"0","L ")

No comments:

Post a Comment