cancel
Showing results for 
Search instead for 
Did you mean: 

select count (*) from sapsr3.VBHDR where vbdate = TO_CHAR( CURRENT_DATE,'FXYYYYMMDDHHMISS');

0 Kudos

Hello Friends,

I am trying below command and its not giving any output.

select count (*) from sapsr3.VBHDR where vbdate = TO_CHAR( CURRENT_DATE,'FXYYYYMMDDHHMISS');

Any help would be appriciated.

Regards,

Gurprinder

Accepted Solutions (0)

Answers (5)

Answers (5)

0 Kudos

Hi Kashyap,

Fixed myself. below is the answer. I am using oracle. below query will give you total no of failed updated in SAP (sm13) for current date when you run the query

select count(*) from sapsr3.vbhdr where vbrc >= 2 and vbrc <= 201 and vbdate >= TO_CHAR ( Current_date, 'FXYYYYMMDD HH24MISS');

Regards,

Gurprinder

0 Kudos

Hi Kashyap,

i am trying in oracle. below is output.

SQL> select count(*) from sapsr3.VBHDR where VBDATE like CONCAT(CAST(CURRENT_DATE AS VARCHAR),'%'); select count(*) from sapsr3.VBHDR where VBDATE like CONCAT(CAST(CURRENT_DATE AS VARCHAR),'%') * ERROR at line 1: ORA-00906: missing left parenthesis

vbdate field format is below.

vbdate

-----------------------

20200105155037

Regards,

Gurprinder

kashyap_shah3
Contributor
0 Kudos

Hi Gurprinder,

I've not got any entries in VBHDR on HANA systems but MS SQL Server where I've tried the query.

select count(*) from <shema>.VBHDR where VBDATE like CONCAT(CONVERT(VARCHAR(20), getdate(), 112),'%')

Above works on MS SQL Server database.

Following query, I think should work on HANA (it does syntactally) but I don't have anyway to verify that it works logically:
select count(*) from <schema>.VBHDR where VBDATE like CONCAT(CAST(CURRENT_DATE AS VARCHAR),'%')

Best Regards,
Kashyap Shah

0 Kudos

Hi Kashyap,

Yes, without where condition it give me total no of updates in system but i want total no of updates for current date. Without where condition i am getting output. issue is with date formatt.

select count (*) from sapsr3.VBHDR where vbdate = TO_CHAR( CURRENT_DATE,'FXYYYYMMDDHHMISS');

Regards,

Gurprinder

kashyap_shah3
Contributor
0 Kudos

Hi Gurprinder,

I guess you mean it returns 0 row. Did you consider that there could actually be no entry with that WHERE condition.

For fun, just try without any condition to make sure table contain something at least.

Best Regards,
Kashyap Shah