OpenSQL uses additives that can only be used with a fixed point arithmetic flag? - abap

I keep having an error message for the selection below. What I have done is creating a global structure, then declaring a structure and a table in the program as TYPE table, as it is seen below:
DATA: gt_add_data_08 TYPE TABLE OF zsd_s_z5_9910_9900_08,
gs_add_data_08 TYPE zsd_s_z5_9910_9900_08.
The selection that I have problem is below:
SELECT gt_add_data_08~bi_desc1,
gt_add_data_08~bi_desc2,
gt_add_data_08~herkl,
gt_add_data_08~herkl_t,
gt_add_data_08~tempb,
gt_add_data_08~tbtxt,
vbdpl~lfimg,
vbdpl~vrkme,
vbdpl-charg
INTO TABLE gs_add_data_08
FROM gt_add_data_08
INNER JOIN vbdpl ON
vbdpl~posnr = gt_add_data_08~posnr,
vbdpl~vbeln = gt_add_data_08~vbeln
WHERE vbdpl~spras = 'EN'.
The selection is supposed to join two tables, thus gt_add_data_08 and vbdpl into gs_add_data_08, with the condition that spras must be in English. The error that is show to me is:
This Open SQL statement uses additives that can only be used with a fixed point arithmetic flag enabled (e.g. CASE Expression, Host variables in expressions, ...)
May anyone know where the problem may be that is showing to me this error?
Thank you all in advance!

Related

Check if an item exists in MDX named set

I want to create a named set for two football teams. I'm not exactly sure what the syntax is, but what I have thus far is:
EXISTS(
[Team].[Team],
{[Team].[Team].&[BAL], [Team].[Team].&[DEN]}
)
In other words, I want to create a Named set if the team is named "BAL" or "DEN". What would be the proper way to write this expresion?
The following query syntax works for me, but I'd like to translate this into "creating a named set" in BIDS:
WITH SET[FavoriteTeams] AS{
[Team].[Team].&[DEN],
[Team].[Team].&[BAL]
}
SELECT
[Measures].[Net Wins] on 0,
[FavoriteTeams] on 1
FROM [NFL]
It seems perhaps it is as simple as just typing that in manually to the expression?
Sets are an important concept in MDX. A set is a collection of members from the same dimension and hierarchy. The hierarchy can be an attribute hierarchy or a user-defined hierarchy.
set = {membre1,member 2 ..}
the simpler the set expression the better it is.
So you should use the second expression
{
[Team].[Team].&[DEN],
[Team].[Team].&[BAL]
}
In your case no need to use the exists function since the members are defined.
we use exists in some setuations like we want to get all the cities of a specific region.
EXISTS([City].[City], [region].[region].[Region].&[1])
Visit : Microsoft.doc

Unknown token in SQL select where statement

I have three tables:
PRESS Table : ID, NAME
REGIONS Table : ID, NAME
Each "Press" is published in certain areas (Regions), so I created a child table called "PRESSREGIONS" :
PRESSREGIONS : ID, NAME, IDPRESS
When trying to select records from PRESSREGIONS related to the current PRESS, I use:
SELECT * FROM PRESSREGION WHERE PRESSREGION.IDPRESS = PRESS.ID
I have the following error:
ERROR -206 TOKEN UNKNOWN PRESS.ID
I even tried with another table and another field just to try and got the same error. Is there anything wrong with my statement?
Delphi RIO 10.3 - Firedac - Firebird 3.0
You need to JOIN with PRESS.
SELECT
pr.*,
p.*
FROM
PRESSREGION AS pr
INNER JOIN PRESS AS p ON pr.IDPRESS = p.ID
You can not use PRESS.id because you did not declared PRESS as something you are going to use.
"Translating" to Delphi your queries would look like having two files:
Unit A;
inteface
var AAA: integer;
implementation
end.
and then
Program B;
begin
AAA := 10;
end.
Trying to compile the program - you would receive just the same error, variable AAA was not defined, the token AAA is not known to the Delphi compiler when compiling the module B. Until you either explicitly declare B-local variable AAA or explicitly declare your intention to import AAA variable from the unit A of all existing units (Program B; uses A; ...) - the program would not compile.
If the compiler can not know with absolute warranty what you intended to do - it can not do guesswork and write the program for you by somewhat random estimations.
Same with SQL, unless you explicitly declare the table PRESS (maybe with a shortcut/alias) as something you do have intent to use - the query compiler would not know.
Read chapter chapter 6.1.3. The FROM clause from Firebird documentation.
Or Martin Gruber's "Essential SQL".
Or there were good beginners books for Delphi 3 and Delphi 5 in Russian and probably in other languages too. Actually, "vast and generic scope, shallow depth" beginners books about SQL databases might do better service to you as of yet, than very detailed "narrow scope in-depth" kinds of documentation.
On option to explicitly declare that would be, in SQL'89 flavor "implicit join" way
SELECT * FROM PRESSREGIONs, Press WHERE PRESSREGIONs.IDPRESS = PRESS.ID
Another option, quoted above by Dai, using SQL'92 "explicit join" flavor would be
SELECT * FROM PRESSREGIONs JOIN Press ON PRESSREGIONs.IDPRESS = PRESS.ID
See more SQL commands and Firebird's reactions to them at https://dbfiddle.uk/?rdbms=firebird_3.0&fiddle=8f32007629284cf0aa30128d5a7b5e10

SQL Server Spatial Select Where STContains

I'm working on a spatial database SQL Server and am having a hard time querying a row where the geography contains a given lat/long.
I'm able to get this query to work:
DECLARE #polygon Geography;
select #polygon = (
select
geog4269
from census_tracts
WHERE namelsad10 = 'Census Tract 9801.02'
);
set #polygon = #polygon.ReorientObject();
select #polygon.STContains(
geography::Point(18.4102591, -66.0732014, 4269)
);
However, I want to be able to select the row that contains a given lat/long with something like the following:
select
*
from census_tracts
WHERE geog4269.ReorientObject().STContains(
geography::Point(18.4102591, -66.0732014, 4269)
) = 1
I'm getting a .NET Framework exception when I run that saying to use MakeValid to avoid it, but adding .MakeValid() doesn't fix the issue.
This is the exception message:
Msg 6522, Level 16, State 1, Line 1
A .NET Framework error occurred during execution of user-defined routine or aggregate "geography":
System.ArgumentException: 24144: This operation cannot be completed because the instance is not valid. Use MakeValid to convert the instance to a valid instance. Note that MakeValid may cause the points of a geometry instance to shift slightly.
System.ArgumentException:
at Microsoft.SqlServer.Types.SqlGeography.ThrowIfInvalid()
at Microsoft.SqlServer.Types.SqlGeography.ReorientObject()
.
When I use the following query:
select
*
from census_tracts
WHERE geog4269.MakeValid().ReorientObject().STContains(
geography::Point(18.4102591, -66.0732014, 4269)
) = 1
The geographies don't get reoriented (every geography says it contains all points).
Has anyone run into something similar before or can point out where I'm going wrong? Thanks for the help!
My guess is for some geographies MakeValid also fixes the orientation of the polygons. If the polygons is invalid, MakeValid has to make a guess about what was the intended shape, and fix it using some heuristics. The results may vary depending on what exactly was wrong with the data - and sometime garbage in, garbage out applies.
I would avoid using both MakeValid() and ReorientObject() in the query. This is both error prone, and slow (as it prevents spatial index usage).
Instead, fix the actual data by updating the geographies to be the intended ones.
Quick and dirty way is to invert only those that need inverting, something like
update census_tracts
set geog4269 =
IF (geog4269.MakeValid().STArea() < 1e14, -- is it small?
geog4269.MakeValid(),
geog4269.MakeValid().ReorientObject());

Syntax error in expression of SSRS

I have two datasets in my report and data is being displayed through a table. When I give expression like below:
=Format(Fields!InvDt.Value, "dsRepSalesReport_tblPrintSalesReport","dd/MMMyyyy")
It says there is Syntax error. If I remove dsRepSalesReport_tblPrintSalesReport part, there is no error.
1) Please advise how to wite the expression in format with aggregate expression.
2) If I write expression without dsRepSalesReport_tblPrintSalesReport part, my table repeats data and shows for all invoice. But when I add aggregate part, dsRepSalesReport_tblPrintSalesReport
Table just shows one value several times.
Please advise how to handel with these two issues.
Thanks
The method signature for Format is:
Public Shared Function Format(
ByVal Expression As Object,
Optional ByVal Style As String = ""
) As String
So that means you can't just specify the field and the Scope as in your first example; the first of the two arguments must return one value only.
In your example, you could use something like:
=Format(First(Fields!InvDt.Value, "dsRepSalesReport_tblPrintSalesReport"), "dd/MMMyyyy")
Which will format the first value in the specified Scope.
Another option would be to just set the value as required in the report then use the Format property:
It's difficult to answer your second question without knowing what your data/required results are... If you update the question with some simplified sample data to illustrate the actual issue you're facing that would be helpful.

SQL Paramaters in FoxPro 2.6 DOS

In FoxPro 2.6 for MS-DOS is there a way to use a variable in a SELECT command? For example, how can I write the following query:
SELECT * FROM DBFILE WHERE Ord_no = temp_no
Given that temp_no is a previously defined variable. I tried using "&temp_no" but this does not appear to be the correct syntax.
Your code looks correct, and you shouldn't need to macro it via the "&". What may be failing is due to data types. If your table "dbfile", column "ord_no" is numeric and your variable "temp_no" is a character string, that would fail due to a data type mismatch... make sure they are the same data type... again, REGARDLESS of using the "&" macro.
MyVarOrd_No = 23
select * from DBFile where Ord_No = MyVarOrd_No
or if a string/charcter based column, just change
MyVarOrd_No = "23"
However you may need to pad with spaces/justify if its being picky.
The microsoft line on using variables in foxpro.