can't find the type 'bigint' in Sybase ASE 12.5.4 - sqldatatypes

is bigint supported in Sybase ASE 12.5.4 ?
if not is there any equalent to bigint in Sybase ASE 12.5.4 ?

Bigint was not added until Sybase ASE 15. The closest to this you will get is NUMERIC(19,0) which will provide the same range as bigint but may take up more space.

Related

Equivalent of Convert varbinary in PostgreSQL for bytea

What is the equivalent of Convert varbinary in PostgreSQL for bytea? Here's a SQL Server example:
CONVERT(varbinary(MAX), 0x5DCC4B0E40401084E1BBF4DA09AC6D24561E07681433310CA3111177D75612CBFFABA42E7276958C4FBF09C5247EA6880CB845F8618063B17EFA986BE5CE87B1E4BAC0B2616AA0EED0496E7B23BA8AC1F85A40ABB55B1C1A09D6413FAB94EE07)
Is there a function in PostgreSQL that does the same thing as Convert in SQL Server for bytea?
Just found the function Decode(). Need to remove the prefix "0x"
decode('5DCC4B0E40401084E1BBF4DA09AC6D24561E07681433310CA3111177D75612CBFFABA42E7276958C4FBF09C5247EA6880CB845F8618063B17EFA986BE5CE87B1E4BAC0B2616AA0EED0496E7B23BA8AC1F85A40ABB55B1C1A09D6413FAB94EE07', 'hex')

What does this SQL-Server syntax do? How to convert into Teiid SQL version?

This is a part of sql syntax,
CONVERT(VARCHAR(MAX), CONVERT(VARBINARY(MAX), HIADDITIONAL, 2))
-- HIADDITIONAL is varchar
What is the syntax supposed to do?
Update
The sql is sql-server syntax. How to convert the syntax into teiid version?

How to convert BLOB to varchar with SAP HANA database using SQL

how do I cast a blob to varchar with SAP HANA database using SQL.
(we need the column to be stored in blob - not TEXT - in else HANA automatically creates an index on this column. But we need an index with full-text-search and CORE_EXTRACTION)
The following code
select
cast("DESCRIPTION" as varchar) "D"
from "DESC"
returns
Could not execute 'select cast("DESCRIPTION" as varchar) "D" from "DESC"' in 30 ms 168 µs .
SAP DBTech JDBC: [266]: inconsistent datatype:
Solved the problem with this select statement
select cast(BINTOSTR(cast(description as binary)) as varchar) from xing_desc
Casting to VARCHAR usually is done by
SELECT TO_ALPHANUM(col) FROM ...

Discover SQL Server procedure default parameters using SYS or INFORMATION_SCHEMA tables

Like Oracle, SQL Server supports parameter defaults in stored procedures. Oracle syntax:
CREATE OR REPLACE PROCEDURE p_default (
p_in_number IN number := 0,
p_out_number OUT number,
p_in_varchar IN varchar2 := '0',
p_out_varchar OUT varchar2,
p_in_date IN date := date '1981-07-10',
p_out_date OUT date
)
SQL Server syntax:
CREATE PROCEDURE p_default (
#p_in_number INTEGER = 0,
#p_out_number INTEGER OUT,
#p_in_varchar VARCHAR(10) = '0',
#p_out_varchar VARCHAR(10) OUT,
#p_in_date DATE = '1981-07-10',
#p_out_date DATE OUT
)
With Oracle, I can discover defaults using this query:
SELECT argument_name, defaulted FROM all_arguments WHERE object_id = :proc_id
How can I discover this in SQL Server selecting from sys or INFORMATION_SCHEMA tables? I don't see any useful column in INFORMATION_SCHEMA.PARAMETERS, and the sys.parameters.has_default_value seems not to be set correctly (!)
Note, I have asked as similar question about DB2:
Discover DB2 procedure default parameters using SYSCAT tables
There's no simple way to do it. As the documentation for has_default_value states:
SQL Server only maintains default values for CLR objects in this catalog view; therefore, this column has a value of 0 for Transact-SQL objects. To view the default value of a parameter in a Transact-SQL object, query the definition column of the sys.sql_modules catalog view, or use the OBJECT_DEFINITION system function.
So you'd have to pull the whole stored proc definition out and parse it yourself to determine the value.
Side note: I'd be wary of #p_in_date DATE = '1981-07-10'. I know that the date datatype is a bit more sensible than datetime, but I'm not sure if the above is still ambiguous - certainly if it was converted to datetime, it may result in 10th July or 7th October, depending on language settings. I'd be more comfortable with '19810710' which will always be interpreted as 10th July.

How to convert from varbinary to char/varchar in mysql

I have a field which is varbinary. It has already been populated. Now how do i convert varbinary to varchar so that I can use the data in the field for some other purpose. I use a MySQL version 5.10
Late answer...
You can use CAST or CONVERT thus
CAST(foo AS CHAR(100))
CONVERT(foo, CHAR(100))
Supported types (5.5) are:
BINARY[(N)]
CHAR[(N)]
DATE
DATETIME
DECIMAL[(M[,D])]
SIGNED [INTEGER]
TIME
UNSIGNED [INTEGER]
You can not cast to varchar directly.
There is an open MySQL bug from 2008 which no-one seems to care about and is damn annoying
The MySQL syntax that worked for me in a similar scenario to this is:
select cast(binaryColumn as CHAR) from table_name
You can use cast operation:
select cast(column_name as char)
from table_name