Last active
May 23, 2017 23:11
-
-
Save ederrafo/3c24c4272ee00d7322da8a7405f2d0e8 to your computer and use it in GitHub Desktop.
All reference sybase
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- SQLAnywhere | |
-- buscar una columna | |
select t.table_name, c.column_name, c.nulls from systabcol c key join systab t on t.table_id = c.table_id | |
where c.column_name = 'salutation' | |
-- Estructura de una tabla | |
SELECT c.column_name | |
FROM systabcol c | |
KEY JOIN systab t ON t.table_id=c.table_id | |
WHERE t.table_name='PayView' ORDER BY column_name DESC | |
/* | |
=== "ISNULL" FUNCTION === | |
Returns the value of the first non-NULL expression in the parameter list. | |
Syntax: ISNULL ( expression, expression [ …, expression ] ) | |
Parameters: expression An expression to be tested against NULL. | |
At least two expressions must be passed to the function. | |
*/ | |
-- Example | |
-- The following statement returns the value -66: | |
SELECT ISNULL( NULL ,-66, 55, 45, NULL, 16 ) FROM iq_dummy | |
--Usage: The ISNULL function is the same as the COALESCE function. | |
=== EXPLICITLY LIMITING THE NUMBER OF ROWS RETURNED BY A QUERY === | |
You can use the FIRST or TOP keywords to limit the number of rows included in the result set of a query. These keywords are for use with queries that include an ORDER BY clause. | |
Examples | |
The following query returns information about the employee that appears first when employees are sorted by last name: | |
SELECT FIRST * | |
FROM Employees | |
ORDER BY Surname; | |
The following query returns the first five employees as sorted by last name: | |
SELECT TOP 5 * | |
FROM Employees | |
ORDER BY Surname; | |
When you use TOP, you can also use START AT to provide an offset. The following statement lists the fifth and sixth employees sorted in descending order by last name: | |
SELECT TOP 2 START AT 5 * | |
FROM Employees | |
ORDER BY Surname DESC; | |
*** Commands *** | |
=== show tables == | |
> sp_tables | |
> go | |
> select table_name from systable | |
> go | |
> SELECT name FROM sysobjects WHERE type = 'U'; | |
> go |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment