cancel
Showing results for 
Search instead for 
Did you mean: 

Must specify table to select from in Exec saved procedure

Mboukhary
Discoverer
0 Kudos

Hi All,

I am working on SAP B1 10 , SQL 2017

When I execute this Query : 

DECLARE @M1 AS varchar(10)
SET @M1 = '20240301'
Exec [dbo].[GIP_SIT_J] @M1
SELECT * FROM [dbo].[@GIP_SIT_J]

It runs OK ; But when I try to use parameters Like this :

--SELECT * FROM OIGE T0 WHERE T0.[DocDate] = [%cs1]
DECLARE @M1 AS varchar(10)
SET @M1 = [%cs1]
Exec [dbo].[GIP_SIT_J] @M1
SELECT * FROM [dbo].[@GIP_SIT_J]

I get Error : Must Specify Table to Select From .....

Thanks for helping to solve this issue.

 

 

Sandra_Rossi
Active Contributor
0 Kudos
Please format your code with buttons "..." and "</>", as Johan did.

Accepted Solutions (0)

Answers (1)

Answers (1)

Johan_H
Active Contributor
0 Kudos

Hi,

I recommend that you change the parameter data type in the [dbo].[GIP_SIT_J] stored procedure to DATETIME first. Then please give this a try:

/* select * from OIGE x */
DECLARE @M1 AS DATETIME
SET @M1 = /* x.DocDate */ [%cs1]
Exec [dbo].[GIP_SIT_J] @M1
SELECT * FROM [dbo].[@GIP_SIT_J]

Regards,

Johan

Mboukhary
Discoverer
0 Kudos
Thank your for your reply
Mboukhary
Discoverer
0 Kudos
Thank your for your reply , but the error persist ..