ali raza

C#, .Net ,Asp.net and my thoughts

Monthly Archives: September 2008

how to insert dateTime in Oracle database using c#

hi all, i have facing problem while Executing Insert query with dataTime on Oracle database. This query is generated by string manuplation using C# at business layer . i fix the date time as in Query

"TO_DATE('" + ProdMonitor.TRANSACTIONDATE.Month+
"/" + ProdMonitor.TRANSACTIONDATE.Day +
"/" + ProdMonitor.TRANSACTIONDATE.Year+
" " + ProdMonitor.TRANSACTIONDATE.ToLongTimeString()+
"','mm/dd/yyyy HH:MI:SS PM'),"

The Whole Query Will be like

 

Insert Into JOBS (JOB_ID , EXECUTION_TIME,CREATION_TIME,SERIAL_NO,STATUS) values(JOB_ID_SEQ.NEXTVAL,TO_DATE('9/29/2008 11:00:00 PM','mm/dd/yyyy HH:MI:SS PM'),TO_DATE('9/26/2008 12:59:59 PM','mm/dd/yyyy HH:MI:SS PM'),'','1')

Chears

Software Development form layman approach

picture worth thousand words check this out

null

Pekar by Sajjad ali with lyrics

Pekar meaning picture

i was surpise to listen this farsi song from pakistani singer, but wordings are beautiful with out standing voice

lyrics are as follow

Pekar-e-Husn-o-jamal-o-khud numai yak taraf
Jaan bay deegar duroon-e-aQL shakl-e-badnuma
Khwab deedan yak taraf tabeer deedan yak taraf

Sazish-o-makr-o-farebi, zarf khoordan gumzada
Haif insaan Haif insaan Shehr-e-mann herat kada

Too hidayat yak taraf, Mushkil kushai yak taraf

Chashm-e-purnam, Chashm-e-purnam
Dil Gariftan, Dil Gariftan
Bar-sar-e-bazar ruswa
Gulistan ra khaak kardan

Kibriyai yak taraf
Khauf-e-Khudai yak taraf

Translation

A life without Reason and tought, a face so distastefull
Watching dreams on one side and their translation on the other

Cheat and Schemes, Conscience has been forgoten
This Human, This Human, lives in its own world inside it so amazing

Giving a good advise on side, and Helping one in need on the other

update statement with select in teradata

hi all, i use following syntex for this


UPDATE T1 FROM (SELECT t2_1, MIN(t2_2) from T2 group by 1) as D (D1, D2)
SET Field2 = D2
WHERE Field1 = D1

 

So i solve my problem as

UPDATE XTZ.KPI FROM (SELECT CONVERTED_TARGET_QTY,NORMAL_VALUE,CRITICAL_VALUE FROM DP_UTL.PRODUCTION_KPI WHERE PACKAGE='SSPET-500') AS D(D1,D2,D3) SET
MaximumValue = D1
, NormalValue = D2
, CriticalValue = D3
WHERE KPIId=125;

 

Chears

How to get first date of last year in teradata Sql

While working on teradata we have to show some reports on database, for example MTD month to date, YTD year to date, While searching Records on The bases of YTD , I have to  Find records till start of last month and till today. The I have to create first date of  last years as follow

select cast(cast( CAST( EXTRACT(YEAR FROM CURRENT_DATE)-1 AS CHAR(4))||'0101' as date format 'yyyymmdd') as date format 'yyyy-mm-dd');