Quantcast
Channel: SCN: Message List - SAP SQL Anywhere
Viewing all 2182 articles
Browse latest View live

Re: Sql Anywhere 12.0.1.3797

$
0
0

Thanks,

 

We executed the script within our program. There must be something wrong.

Executed it in dbisqlc and the problem is solved.

 

Thanks again


OLEDB Provider for SQL Anywhere 7.0 ?

$
0
0

Hello Experts,

Could you please help me in downloading OLEDB Provider for SQL Anywhere 7.0 ?

 

Regards,

Shanmugam K

Re: OLEDB Provider for SQL Anywhere 7.0 ?

Re: OLEDB Provider for SQL Anywhere 7.0 ?

$
0
0
Hello Shanmugam,
If you already have the OLE DB provider DLL files (dboledb7.dll and dboledba7.dll) and just need to
register them with the Microsoft Windows Operating System, you can use the commands:
regsrv32 dboledb7.dll
regsrv32 dboledba7.dll

 

 

The actual OLE DB Provider DLL files are provided as part of the SQL Anywhere software package.
Jeff Albion
SAP Active Global Suppoprt

Divide 111 / 7

$
0
0

When we divide 111 / 7 we get as result 15

When we divide 111 / 7.0 we get as result 15,86

 

What should we do to get as result 15,85714......

 

We use the script (select 111 / 7.0 from dummy)

 

In our SQL scripts are a lot of formulas like var1 / 100.0

I suppose the results of this formula is 2 decimals where I had expected that it would be converted to a decimal

 

 

Thanks

Eric

Re: Divide 111 / 7

$
0
0

That interesting question shows the effect of default type conversions. Numeric constants may be interpreted diffently depending on their value.

 

Executing this statement

SELECT 111/7.0 AS singleprec, CAST (111/7.0 AS DOUBLE) double1prec, 111 / CAST (7.0 as DOUBLE) double2prec

 

gives the following results in ISQL (SQLA 12.0.1):

 

singleprec,double1prec,double2prec

15.86,15.8571,15.857142857142858

 

So it looks like the given values are interpreted as INTEGER and REAL respectively. The explict cast to DOUBLE has different effects when applied to the result or one operand.

 

Cf. the documentation dcx.sybase.com/index.html#1201/en/dbreference/dtco.html

Re: Divide 111 / 7

$
0
0

Somewhere, there's a relatively recent article about implicit data type conversions in numeric expressions, written by one of the Alphas at iAnywhere, but I can't find it. In the meantime, EXPRTYPE is your friend when researching problems, and CAST is your friend when fixing them.

SELECT '1. 111' AS "expr", 111 AS "value", EXPRTYPE ( 'SELECT 111', 1 ) AS "datatype"
UNION
SELECT '2. 7',                          7,                                                EXPRTYPE ( 'SELECT 7', 1 )
UNION
SELECT '3. 111 / 7',                    111 / 7,                                          EXPRTYPE ( 'SELECT 111 / 7', 1 )
UNION
SELECT '4. 111 / 7.0',                  111 / 7.0,                                          EXPRTYPE ( 'SELECT 111 / 7.0', 1 )
UNION
SELECT '5. 111 / CAST ( 7 AS DOUBLE )', 111 / CAST ( 7 AS DOUBLE ),                                         EXPRTYPE ( 'SELECT 111 / CAST ( 7 AS DOUBLE )', 1 )
UNION
SELECT '6. 111 / CAST ( 7 AS DECIMAL ( 30, 15 ) )',                                          111 / CAST ( 7 AS DECIMAL ( 30, 15 ) ),                                          EXPRTYPE ( 'SELECT 111 / CAST ( 7 AS DECIMAL ( 30, 15 ) )', 1 )
ORDER BY 1;

expr,                                        value,              datatype
'1. 111',                                    111.0,              smallint
'2. 7',                                      7.0,                smallint
'3. 111 / 7',                                15.0,               smallint
'4. 111 / 7.0',                              15.8571,            numeric(5,2)
'5. 111 / CAST ( 7 AS DOUBLE )',             15.857142857142858, double
'6. 111 / CAST ( 7 AS DECIMAL ( 30, 15 ) )', 15.857142857142858, numeric(30,12)

Re: Divide 111 / 7

$
0
0

I think the article Breck is referring to can be found here:

Scale used when evaluating a simple expression in SQL - SQLA Forum

 

Testing using constant values does not equate to what the server will do with variables/database columns.  For example, the value "7" stored in a column defined as numeric(30,6) is not the same as the constant value "7" typed in explicitly, since for constants the server will assign a datatype based on the value provided.

 

The best advice I can give is that if you are looking for a specific precision/scale in a result, you should make sure your inputs have that precision/scale.

 

--Jason


SQL Anywhere 16 developer edition download problem for Mac OS X

$
0
0

Hi,

 

I would like to try SQL Anywhere 16 for Mac OS X as that is my primary home computer.

However every time I go to download it fails. Either I get a "please be patient, your download will start in a few seconds" and never starts or I get about 2mb through and it aborts on my Mac.

Has anyone else successfully downloaded the software for Mac OS X?

I have downloaded SQL Anywhere 16 for other operating systems successfully but as I state, ideally, I would like to try out the Mac version.

Any assistance appreciated and I have tried the download from Chrome on a Mac and Firefox and Chrome on windows.

 

Chrome I get

chromesql16error.PNG

Firefox it just loops

firefox16error.PNG

 

Thanks

Robert

Ultralite database is not Supporting delete operation in Query class in Android Native App using SUP 2.2 SP 4

$
0
0

Hi All,

 

I am developing Android Native Application using SUP 2.2 SP04 generated code.I want to use ultralite database and develop select,create and delete operations in that.


I am Using Select operation perfectly but unable to use Delete and Insert Operations in "Query" Class(API Given by Sybase).

 

Anyone please suggest me how to overcome this issue and possibilities to do these Operations in my Android Native Application.

 

Here is my Query,

 

Query query = new Query();

         query.select("x.ID, x.TITLE, x.DESCRIPTION");

         query.from("MyLocalDatabaseDB", "x");

         query.orderBy("id", SortOrder.ASCENDING);

         query.setTake(take);

         query.setSkip(skip);

 

 

 

Regards,

V B Jampana.

Inventory by LocationId (were locations are hierarchical)

$
0
0

Hi,

 

 

I have a problem with an inventory system I'm designing.  It is an inventory system by LocationId.   The problem I have is that the locations are hierarchical.   By hierarchical I mean that a given location might belong to a next location.

 

 

For example given the following (simplified) schema of 3 tables (Locations, Articles and Inventory)

 

 

CREATE  TABLE Locations (

LocationId                 INTEGER NOT NULL,

ParentLocationId           INTEGER NULL,

CONSTRAINT w_Ub_LLAVE PRIMARY KEY (LocationId)

)

GO

 

 

INSERT INTO Locations (LocationId,ParentLocationId) VALUES (1,NULL);

INSERT INTO Locations (LocationId,ParentLocationId) VALUES (2,NULL);

INSERT INTO Locations (LocationId,ParentLocationId) VALUES (3,NULL);

INSERT INTO Locations (LocationId,ParentLocationId) VALUES (4,1);

INSERT INTO Locations (LocationId,ParentLocationId) VALUES (5,4);

INSERT INTO Locations (LocationId,ParentLocationId) VALUES (6,4);

INSERT INTO Locations (LocationId,ParentLocationId) VALUES (7,5);

 

 

 

 

CREATE TABLE Articles  (

ItemId                     INTEGER NOT NULL,

Description                VARCHAR(50),

CONSTRAINT ArticlePK PRIMARY KEY (ItemId)

)

GO

 

 

INSERT INTO Articles (ItemId,Description)  VALUES (100,'BREAD');

 

 

 

 

CREATE TABLE Inventory (

LocationId                 INTEGER NOT NULL,

ItemId                     INTEGER NOT NULL,

Qty                        DECIMAL(14,4) NULL,

CONSTRAINT InventoryPK PRIMARY KEY (LocationId,ItemId)

)

GO

 

 

INSERT INTO Inventory (LocationId,ItemId,Qty) VALUES (1,100,5);

INSERT INTO Inventory (LocationId,ItemId,Qty) VALUES (2,100,5);

INSERT INTO Inventory (LocationId,ItemId,Qty) VALUES (3,100,5);

INSERT INTO Inventory (LocationId,ItemId,Qty) VALUES (4,100,5);

INSERT INTO Inventory (LocationId,ItemId,Qty) VALUES (5,100,5);

INSERT INTO Inventory (LocationId,ItemId,Qty) VALUES (6,100,5);

INSERT INTO Inventory (LocationId,ItemId,Qty) VALUES (7,100,5);

 

 

 

 

 

 

I would like to list the contents by locationId.

 

 

For example, if I list LocationId=1 I should get

5 (in LocationId = 1) +

5 (in LocationId = 4 which belongs to 1) +

5 (in LocationId=5 which belongs to 4 which belongs to 1) +

5 (in LocationId=6 which belongs to 4 which belongs to 1) +

5 (in LocationId=7 which belongs to 5 which belongs to 4 which belongs to 1)

= 25

 

 

If I list LocationId=7 I would only get 5 (those in locationId=7)

 

 

If I list LocationId=5 I would bet 10 (those in LocationId=5 and those in LocationId=7).

 

 

 

 

Hopefully I was able to explain myself.   Does anybody know how this could be done?

 

 

Thanks,

Edgard

Re: SQL Anywhere 16 developer edition download problem for Mac OS X

$
0
0

Hi Robert,

    I have occasionally had this problem in the past and I think it is somehow related to the SAP ID service stored in my browser.  I found that clearing my cookies and re-logging in to the SAP ID service resolved the download issue for me.  Can you give that a try and see if it helps?  FWIW, I just downloaded the MAC OS install with no problems.

 

--Jason

Re: Inventory by LocationId (were locations are hierarchical)

Re: Ultralite database is not Supporting delete operation in Query class in Android Native App using SUP 2.2 SP 4

$
0
0

Hello Varahalu,

 

You will likely want to re-ask this question in the SAP Mobile Platform Developer Center discussion area if this question is specific to SUP development (we can also move this question there for you, with your permission).

 

While UltraLite is a part of SUP, UltraLite does not support the Query() interface directly - that is a part of the SUP API.

 

---

 

If you are interested in porting your existing SUP / SMP application to an UltraLite-only application using only UltraLite, you should review the UltraLite documentation for a tutorial on Android development. If you do not currently have a license for SQL Anywhere (which includes UltraLite), you can download a developer copy of SQL Anywhere to start your development and testing.

 

Regards,

 

Jeff Albion

SAP Active Global Support

Re: Inventory by LocationId (were locations are hierarchical)

$
0
0

Hi Edgard,

 

The first part of your problem is a common recursive query problem. You will want to first create a list of related Location IDs based on an initial Location ID:

WITH RECURSIVE

  location_table ( LocationId, ParentLocationId, location_level ) AS

( ( SELECT LocationId, ParentLocationId, 0

    FROM Locations AS l

    WHERE ParentLocationId IS NULL )            -- initial query

  UNION ALL

  ( SELECT l.LocationId, l.ParentLocationId, lt.location_level + 1

    FROM Locations AS l

    JOIN location_table AS lt

      ON l.ParentLocationId = lt.LocationId

     AND l.ParentLocationId <> l.LocationId ) ) -- recursive query

SELECT * FROM location_table

ORDER BY location_level, LocationId;

 

The initial query supplies the rows to match for the recursive query. If you change the where clause to query for your initial target location you would like to match:

 

WITH RECURSIVE

  location_table ( LocationId, ParentLocationId, location_level ) AS

( ( SELECT LocationId, ParentLocationId, 0

    FROM Locations AS l

  WHERE LocationId = 1 ) -- initial query

 

You generate a list of matched locations:

 

LocationIdParentLocationIdlocation_level
1(NULL)0
411
542
642
7

5

3

 

Once you have this list, you can then start matching your inventory values:

WITH RECURSIVE

  location_table ( LocationId, ParentLocationId) AS

( ( SELECT LocationId, ParentLocationId

    FROM Locations AS l

    WHERE LocationId = 1 )

  UNION ALL

  ( SELECT l.LocationId, l.ParentLocationId

    FROM Locations AS l

     JOIN location_table AS lt

       ON l.ParentLocationId = lt.LocationId

      AND l.ParentLocationId <> l.LocationId ) )

SELECT lt.LocationId, i.ItemId, i.qty

FROM location_table lt, Inventory i

WHERE lt.LocationId = i.LocationId;

LocationIdItemIdqty
11005
41005
61005
51005
71005

 

You can then sum as appropriate in a stored procedure:

CREATE OR REPLACE PROCEDURE get_item_quantity_by_location( IN @query_location_id INTEGER )

RESULT( location_id INTEGER, qty INTEGER )

BEGIN

    WITH RECURSIVE

      location_table ( LocationId, ParentLocationId ) AS

    ( ( SELECT LocationId, ParentLocationId

        FROM Locations AS l

        WHERE LocationId = @query_location_id )

      UNION ALL

( SELECT l.LocationId, l.ParentLocationId

        FROM Locations AS l

             JOIN location_table AS lt

               ON l.ParentLocationId = lt.LocationId

                AND l.ParentLocationId <> l.LocationId ) )

    SELECT @query_location_id, SUM(i.qty)

    FROM location_table lt, Inventory i

    WHERE lt.LocationId = i.LocationId;

END;


and then call the procedure with your location ID of interest:

SELECT * FROM get_item_quantity_by_location(1);

 

location_idqty
1

25

 

SELECT * FROM get_item_quantity_by_location(5);

 

location_idqty
5

10


Regards,

 

Jeff Albion

SAP Active Global Support


Re: Ultralite database is not Supporting delete operation in Query class in Android Native App using SUP 2.2 SP 4

$
0
0

Thank You Mr.Jeff Albion,

Your suggestion is needful and I will re ask this question as you suggested.

I hope Ultralite in SUP not supporting Delete and Insert Operations (I read API doc).

as per my requirement I should work with Device database only(Ultralite DB).

 

 

Regards,

V B Jampana

Re: Inventory by LocationId (were locations are hierarchical)

Re: SQL Anywhere 16 developer edition download problem for Mac OS X

$
0
0

Hi Jason,

Thank you,

Clearing the browser cache and re-logging back in allowed me to download the Mac OS version.

I was convinced there was something "special" about the Mac download after failing to download from my Mac and Windows and various browsers. However the download kicked into life after following your suggestions.

Cheers

Robert

Can't get DECLARE statement to work

$
0
0

Running ASA 11 version 11.0.1.2878

 

Hi all. I am trying run a SQL script from MS SQL in ASA11. I can’t figure out what is wrong with the syntax.

 

In MS SQL it look like this and runs OK:

DECLARE @newItemName as varchar(50)

 

In ASA 11 I believe it should look like this (my other declarations seem to work):

DECLARE @newItemName varchar(50 char);

 

But ASA refuses  to execute that statement. Here is the syntax reference I’m using.

http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc00801.1510/html/iqrefso/X315717.htm

 

I've tried several combinations and it's probably something simple but I'm just not seeing it!

 

Thanks in advance!

Tony

Re: Can't get DECLARE statement to work

$
0
0

Hi Tony,

But ASA refuses  to execute that statement.


Can you clarify this problem? Does this mean that you get an error, or the statement doesn't have the effect you were expecting...?

 

The line executed on its own inside Interactive SQL is fine:

DECLARE @newItemName varchar(50 char);


Execution time: 0.003 seconds

 

SELECT @@version;

 

11.0.1.3069

 

Back to your original problem:

I am trying run a SQL script from MS SQL in ASA11. I can’t figure out what is wrong with the syntax.

 

Is the script originally written in Transact-SQL? SQL Anywhere has some native support for Transact-SQL statement syntax - but it looks like you are currently using Watcom SQL (the native SQL Anywhere dialect) for this statement (due to the semi-colon). Are you re-writing the script to target the Watcom SQL or Transact-SQL dialect?

 

Also be aware that in SQL Anywhere, the choice of SQL dialect will affect the ability to place "DECLARE" in a compound statement:

 

The body of a Watcom-SQL procedure or trigger is a compound statement, and variables must be declared with other declarations, such as a cursor declaration (DECLARE CURSOR), immediately following the BEGIN keyword. In a Transact-SQL procedure or trigger, there is no such restriction.

 

Regards,

 

Jeff Albion

SAP Active Global Support

Viewing all 2182 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>