Quantcast
Channel: SCN : Popular Discussions - Code Exchange
Viewing all articles
Browse latest Browse all 1399

Square brackets breaking my query vs UDT?

$
0
0

SAP B1 8.8, PL 20

 

Good day. In Query Manager I'm trying to use a parameter with a UDT and no matter what I try I get the error Messages below. I think the problem involves my wrapping the UDT name in square brackets which I have to do to account for the special character ("@") in the table name. It doesn't just affect UDTs as the samples below show. But it's a combination of square brackets and also using the parameter. And in the case of OCRD it's also the schema name prefix. I have done a lot of research but I can't find a way to use parameters with UDTs. Any ideas?

 

Succeeds

SELECT * FROM dbo.OCRD T0 WHERE T0.CardCode = '[%0]'

 

Fails

SELECT * FROM dbo.[OCRD] T0 WHERE T0.CardCode = '[%0]'

 

Succeeds

SELECT * FROM [OCRD] T0 WHERE T0.CardCode = '[%0]'

 

Succeeds

SELECT * FROM dbo.[@BP_SUBGROUPS]

 

Fails

SELECT * FROM [@BP_SUBGROUPS] T0 WHERE Code = '[%0]'

 

Here are the error Messages:

1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Must specify table to select from.

2). [Microsoft][SQL Server Native Client 10.0][SQL Server]Statement 'Service Contracts' (OCTR) (s) could not be prepared.

 

Some times the table name in Message 2 is different.


Viewing all articles
Browse latest Browse all 1399

Trending Articles