Date post: | 04-Jun-2018 |
Category: |
Documents |
Upload: | smruti2012 |
View: | 230 times |
Download: | 0 times |
of 40
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
1/40
Sybase IQQuick Reference
Sybase IQ Release 11.2.x
Document ID: 36125-01-1121-02
Last Revised: September 19, 1997
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
2/40
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
3/40
Principal author: AIPD Technical Publications
Document ID:36125-01-1121
This publication pertains to Sybase IQ Release 11.2.x of the Sybase databasemanagement software and to any subsequent version until otherwise indicated innew editions or technical notes. Information in this document is subject to changewithout notice. The software described herein is furnished under a licenseagreement, and it may be used or copied only in accordance with the terms of thatagreement.
Document Orders
To order additional documents, U.S. and Canadian customers should call
Customer Fulfillment at (800) 685-8225, fax (617) 229-9845.Customers in other countries with a U.S. license agreement may contact CustomerFulfillment via the above fax number. All other international customers shouldcontact their Sybase subsidiary or local distributor.
Upgrades are provided only at regularly scheduled software release dates.
Copyright 19891997 by Sybase, Inc. All rights reserved.
No part of this publication may be reproduced, transmitted, or translated in anyform or by any means, electronic, mechanical, manual, optical, or otherwise,without the prior written permission of Sybase, Inc.
Sybase Trademarks
Sybase, the Sybase logo, APT-FORMS, Certified SYBASE Professional, DataWorkbench, First Impression, InfoMaker, PowerBuilder, Powersoft, ReplicationServer, S-Designor, SQL Advantage, SQL Debug, SQL SMART, SQL Solutions,Transact-SQL, Visual Components, VisualWriter, and VQL are registeredtrademarks of Sybase, Inc. Adaptable Windowing Environment, AdaptiveComponent Architecture, Adaptive Server, Adaptive Server Monitor, AdaptiveWarehouse, ADA Workbench, AnswerBase, Application Manager, AppModeler,APT-Build, APT-Edit, APT-Execute, APT-Library, APT-Translator, APTWorkbench, Backup Server, BayCam, Bit-Wise, ClearConnect, Client-Library,Client Services, CodeBank, Column Design, Connection Manager, DataArchitect,Database Analyzer, DataExpress, Data Pipeline, DataWindow, DB-Library,dbQueue, Developers Workbench, DirectConnect, Distribution Agent,Distribution Director, Dynamo, Embedded SQL, EMS, Enterprise Client/Server,Enterprise Connect, Enterprise Manager, Enterprise SQL Server Manager,Enterprise Work Architecture, Enterprise Work Designer, Enterprise WorkModeler, EWA, Formula One, Gateway Manager, GeoPoint, ImpactNow,
InformationConnect, InstaHelp, InternetBuilder, iScript, Jaguar CTS, jConnect forJDBC, KnowledgeBase, Logical Memory Manager, MainframeConnect,Maintenance Express, MAP, MDI Access Server, MDI Database Gateway,media.splash, MetaBridge, MetaWorks, MethodSet, Net-Gateway, NetImpact,Net-Library, ObjectConnect, ObjectCycle, OmniConnect, OmniSQL AccessModule, OmniSQL Toolkit, Open Client, Open ClientConnect, Open
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
4/40
Client/Server, Open Client/Server Interfaces, Open Gateway, Open Server, OpenServerConnect, Open Solutions, Optima++, PB-Gen, PC APT-Execute, PC DB-Net,PC Net Library, Power++, Power AMC, PowerBuilt, PowerBuilt withPowerBuilder, PowerDesigner, Power J, PowerScript, PowerSite, PowerSocket,Powersoft Portfolio, PowerStudio, Power Through Knowledge, PowerWareDesktop, PowerWare Enterprise, ProcessAnalyst, QuickStart DataMart,QuickStart ReportSmart, Replication Agent, Replication Driver, Replication ServerManager, Report-Execute, Report Workbench, Resource Manager, RW-DisplayLib,RW-Library, SAFE, SDF, Secure SQL Server, Secure SQL Toolset, SecurityGuardian, SKILS, smart.partners, smart.parts, smart.script, SQL Anywhere, SQLCode Checker, SQL Edit, SQL Edit/TPU, SQL Modeler, SQL Remote, SQL Server,SQL Server/CFT, SQL Server/DBM, SQL Server Manager, SQL Server SNMPSubAgent, SQL Station, SQL Toolset, Sybase Central, Sybase Client/ServerInterfaces, Sybase Development Framework, Sybase Gateways, Sybase IQ, SybaseMPP, Sybase SQL Desktop, Sybase SQL Lifecycle, Sybase SQL Workgroup, Sybase
Synergy Program, Sybase Virtual Server Architecture, Sybase User Workbench,SybaseWare, SyBooks, System 10, System 11, the System XI logo, SystemTools,Tabular Data Stream, The Architecture for Change, The Enterprise Client/ServerCompany, The Future is Wide Open, The Model for Client/Server Solutions, TheOnline Information Center, Translation Toolkit, Turning Imagination Into Reality,UNIBOM, Unilib, Uninull, Unisep, Unistring, URK Runtime Kit for UniCode,Viewer, VisualSpeller, WarehouseArchitect, Warehouse WORKS, Watcom, WatcomSQL, Watcom SQL Server, Web.PB, Web.SQL, WebSights, WebViewer, WorkGroupSQL Server, XA-Library, and XA-Server are trademarks of Sybase, Inc. 8/97
All other company and product names used herein may be trademarks orregistered trademarks of their respective companies.
Restricted Rights
Use, duplication, or disclosure by the government is subject to the restrictions setforth in subparagraph (c)(1)(ii) of DFARS 52.227-7013 for the DOD and as set forthin FAR 52.227-19(a)-(d) for civilian agencies.
Sybase, Inc., 6475 Christie Avenue, Emeryville, CA 94608.
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
5/40
Sybase IQ Quick Reference v
Table of Contents
Commands
CASE Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
FROM Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
GROUP BY Clause. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
HAVING Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
IQ ADD SEGMENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
IQ ALTER INDEXSET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
IQ BACKUP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
IQ CLOSE INDEXSPACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3IQ CREATE INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
IQ CREATE INDEXSET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
IQ CREATE INDEXSPACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
IQ CREATE INDEXSPACE TEMPLATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
IQ CREATE JOINED INDEXSET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
IQ DBCC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
IQ DELETE FROM INDEXSET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
IQ DROP INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
IQ DROP INDEXSET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
IQ DROP INDEXSPACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
IQ DROP JOINED INDEXSET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
IQ DROP SEGMENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
IQ INSERT INTO. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
IQ INSERT INTO JOINED INDEXSET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
IQ PASS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
IQ RESTORE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
IQ SET (Administration). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
IQ SET (Query Processing) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
IQ SHOW INDEXSET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
IQ SHOW INDEXSET INDEXES. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
IQ SHOW INDEXSET JOINED INDEXSETS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
IQ SHOW INDEXSPACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
IQ SHOW INDEXSPACE INDEXES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15IQ SHOW INDEXSPACE JOINED INDEXSETS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
IQ SHOW SET VALUES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
IQ SHOW...SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
6/40
vi Table of Contents
Sybase IQ Release 11.2.x
IQ STATUS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
ORDER BY Clause. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Query Expression. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Search Conditions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
SELECT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
SHUTDOWN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
USE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
WHERE Clause. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Stored Procedures
sp_IQAddLogin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
sp_IQAddLogins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
sp_IQDropBadSegment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
sp_IQDropLogin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
sp_IQDropLoginAnyUser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
sp_IQDropLogins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
sp_IQDropLoginsAnyDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
sp_IQEstJoin. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
sp_IQEstSegments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
sp_IQEstSpace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
sp_IQRenameIndexSpace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
sp_IQRenamePath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
sp_IQRestartHungIndexSpace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22sp_IQSetSharedMemory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
sp_IQShowBadLogins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
sp_IQShowFileFormat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
sp_IQShowFileFormatSp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
sp_IQShowFileFormatSys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
sp_IQShowHungIndexSpaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
sp_IQShowIndexSegments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
sp_IQShowIndexSpaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
sp_IQShowLogins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
sp_IQShowUsers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Functions
AVG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
CAST. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
CONVERT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
7/40
Sybase IQ Quick Reference vii
Sybase IQ Release 11.2.x
COUNT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
COUNT(*) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
DATEADD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
DATEDIFF. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
DATEPART. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
DIFFERENCE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
LEFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
LENGTH or DATALENGTH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
LOWER or LCASE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
LTRIM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
MAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
MIN. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28RIGHT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
ROUND. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
RTRIM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
SIMILAR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
SOUNDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
STRING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
SUBSTRING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
SUM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
SUSER_ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
SUSER_NAME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
TRIM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
UPPER or UCASE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
8/40
viii Table of Contents
Sybase IQ Release 11.2.x
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
9/40
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
10/40
2 Commands
HAVING Clause Sybase IQ Release 11.2.x
You can group a indexset by a single column or by a list of columns.If aggregate functions are included in the select list, GROUP BYalsofinds a summary value(s) for each group. These summary valuesappear as new columns in the results.
Syntax
[GROUP BY
[[indexspace].][[owner].][indexset_name.]
column_name
[, [[indexspace].][[owner].][indexset_name.]
column_name]...
HAVING Clause
Restricts the groups you retrieve in the GROUP BYclause based on thespecified search condition.
Syntax
[HAVINGsearch_condition]
IQ ADD SEGMENT
Creates additional segments across multiple operating system filesor partitions for either an existing Sybase IQ indexspace or the
transaction image data to add more free space and allow formultivolume support.
Syntax
IQ ADD SEGMENT FORindexspace_name,
PATHNAME = "path_name"
[, {INDEXSPACE | TRANSACTIONIMAGE
[, {PREALLOCATE | AUTOALLOCATE}]}]
[, {RAW | FILE [, SIZE =#_of_blocks]}]
IQ ALTER INDEXSET
Adds columns to or drops a column from an existing indexset. Thechanges are propagated to all joined indexsets that include thatindexset.
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
11/40
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
12/40
4 Commands
IQ CREATE INDEX Sybase IQ Release 11.2.x
IQ CREATE INDEX
Adds an index to a column in an indexset of the given index type.
Syntax
IQ CREATE [UNIQUE] INDEX
[[[indexspace].][owner].]index_nameON
[[[indexspace].][owner].]indexset_name
(column_name)index_type
[[WITH] [insert_load_option]
[, insert_load_option]...]
[CREATE [UNIQUE] INDEX
[[[indexspace].][owner].]index_nameON[[[indexspace].][owner].]indexset_name
(column_name)index_type
[[WITH] [insert_load_option]
[, insert_load_option]...]]...
IQ CREATE INDEXSET
Creates a Sybase IQ indexset and defines all the columns that are partof that indexset.
This indexset must have an underlying database table of the samename. The Sybase IQ indexset can have fewer columns than the
underlying table, but it cannot have any columns that are unknownto the underlying table.
When you create a Sybase IQ indexset, Sybase IQ automaticallycreates anIQ_ROWIDcolumn in the indexset to be used for recordnumber reference.
Syntax
IQ CREATE INDEXSET FOR
[[[indexspace].][owner].]indexset_name
(column_name datatype[{NULL | NOT NULL}]
[,column_name datatype[{NULL | NOT NULL}]]...)
IQ CREATE INDEXSPACE
Creates a new Sybase IQ indexspace, which contains the datadefinitions and data for Sybase IQ indexes. An underlying database
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
13/40
Sybase IQ Quick Reference 5
Sybase IQ Release 11.2.x IQ CREATE INDEXSPACE TEMPLATE
of the same name must already exist for this command for it to beexecuted successfully.
There are two classes of indexspace:
Main indexspace
Private indexspace (personal read/write indexspace)
The IQ CREATE INDEXSPACEcommand creates a preallocatedindexspace that can be used as a main or private indexspace.
Syntax
IQ CREATE INDEXSPACE FORindexspace_name,
PATHNAME="path_name"
[, {RAW [, SIZE=#_of_blocks] | [FILE,]
SIZE=#_of_blocks}]
[, BLOCKSIZE =power_of_2_from_512_to_32K]
[, MAXCOMPRESSION =power_of_2_from_2_to_16]
[, FLPATHNAME = "path_name"]
[, LOGPATHNAME = "path_name"]
{[, TIPATHNAME = "path_name" [, TIRAW]] |
[, TIPATHNAME = path_name] [, TIFILE]
[, {TIAUTOALLOCATE | TIPREALLOCATE}]
[, TISIZE = #]}
[, SHMEMMB =#_of_MB_in_main_buffer_cache]
[, TEMPSHMEMMB =#_of_MB_in_private_buffer_cache]
IQ CREATE INDEXSPACE TEMPLATE
Builds a script that can be used to create a new Sybase IQ indexspacewhich contains the indexsets, column indexes, and data definitionsfor Sybase IQ indexes, based on an underlying database of the samename. This script builds an indexspace to match the underlyingdatabase.
This script can be modified and used as input to the Sybase IQcommand line.
Syntax
IQ CREATE INDEXSPACE TEMPLATE
[FOR [[[database].][owner].]table_name],PATHNAME=filename [, APPEND]
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
14/40
6 Commands
IQ CREATE JOINED INDEXSET Sybase IQ Release 11.2.x
IQ CREATE JOINED INDEXSET
Creates a Sybase IQ joined indexset, a group of indexsets that areprejoined, to improve performance on queries against multipleindexsets in the same indexspace.
Syntax
IQ CREATE JOINED INDEXSET
[[[indexspace].][owner].]joined_indexset_name
FOR [[[indexspace].][owner].]indexset_name
(join_field[,join_field]...]) =
[[[indexspace].][owner].]indexset_name(join_field
[,join_field]...])join_relationship
[, [[[indexspace].][owner].]indexset_name
(join_field[,join_field]...]) =
[[[indexspace].][owner].]indexset_name(join_field
[,join_field]...])join_relationship...
IQ DBCC
Checks every block in the indexspace and saves the information inthe current session until the next IQ DBCC CHECKDBcommand isissued. The information can be displayed by using IQ SHOWINDEXSPACE STATS.
SyntaxIQ DBCC [{MAIN | PRIVATE}] CHECKDB
IQ DELETE FROM INDEXSET
Deletes rows from a single indexset.
Syntax
IQ DELETE FROM INDEXSET
FOR [[[indexspace].][owner].]indexset_name
[WITHdelete_load_option[,delete_load_option]...]
[WHEREsearch_condition]
IQ DROP INDEX
Drops a column index from the indexspace.
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
15/40
Sybase IQ Quick Reference 7
Sybase IQ Release 11.2.x IQ DROP INDEXSET
Syntax
IQ DROP INDEX [[[indexspace].][owner].]index_name
[, [[[indexspace].][owner].]index_name]...
IQ DROP INDEXSET
Deletes an indexset and its column indexes.
Syntax
IQ DROP INDEXSET FOR
[[[indexspace].][owner].]indexset_name
IQ DROP INDEXSPACE
Deletes an indexspace and its contents. Removes files for theindexspace and modifies the sysIQ_* tables.
Syntax
IQ DROP INDEXSPACE FORindexspace_name
IQ DROP JOINED INDEXSET
Deletes a joined indexset from the indexspace.
Syntax
IQ DROP JOINED INDEXSET
[[[indexspace].][owner].]joined_indexset_name
IQ DROP SEGMENT
Drops the last segment of a Sybase IQ indexspace.
Syntax
IQ DROP SEGMENT FORindexspace_name
[, {INDEXSPACE | TRANSACTIONIMAGE}]
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
16/40
8 Commands
IQ INSERT INTO Sybase IQ Release 11.2.x
IQ INSERT INTO
Inserts new data into Sybase IQ indexset columns. When you insertdata into a column in a Sybase IQ indexset, Sybase IQ inserts datainto all the column indexes that exist for that column of the indexset.
You can insert data from four sources:
Direct input, indicating specific values row by row
Other Sybase IQ indexed data in the main indexspace orassociated preallocated private indexspaces
A table in an underlying database
One or more flat files
For large volume loads, the last two sources are recommended.
Syntax
IQ INSERT INTO INDEXSET
FOR [[[indexspace].][owner].]indexset_name
({column_name[insert_conversion_option
[,insert_conversion_option]...]
| FILLER(field_descriptor)}
[, {column_name[insert_conversion_option
[,insert_conversion_option]...]
| FILLER(field_descriptor)}]...)
[[WITH]insert_load_option
[, insert_load_option]...]
{row-value-clause|table-or-indexset-clause|
flat-file-clause}
insert_conversion_option=
{ASCII (field_descriptor)
| DATE ('input_date_format')
| DATETIME ('input_date/time_format')
| NULLS ({BLANKS | ZEROS | 'literal'
[, 'literal']...})}
field_descriptor=
{input_width| PREFIX1 | PREFIX2 | PREFIX4
| 'delimiter_string'}
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
17/40
Sybase IQ Quick Reference 9
Sybase IQ Release 11.2.x IQ INSERT INTO JOINED INDEXSET
insert_load_option=
{BLOCKFACTOR =#
| BLOCKSIZE =#
| BYTEORDER = {NATIVE | HIGHORDER | LOWORDER}
| LIMIT =max_#_of_records_to_read
| MBSORT =#_of_MB_memory_for_sort
| NOTIFY =notify_every_#_of_rows
| ONFILEERROR = {ROLLBACK | COMMIT | CONTINUE}
| PREVIEW
| ROWTERMINATOR = 'delimiter_string'
| SKIP =#_of_rows_to_skip
| STARTRECID =#}
row-value-clause=
VALUES (value[, value]...)
table-or-indexset-clause=
[USING ATTACHED [{DATABASE | DB}]]SELECT-statement
flat-file-clause=
USING 'input_file'[, 'input_file']...
IQ INSERT INTO JOINED INDEXSET
Inserts data into a Sybase IQ joined indexset. You insert data into ajoined indexset for all the indexsets in the join relationship. With theIQ INSERT INTO JOINED INDEXSETcommand, you can insert data into ajoined indexset from three sources:
Other Sybase IQ indexed data in the main indexspace orassociated preallocated private indexspaces
A table in an underlying database
One or more flat files
Use a separate IQ INSERT INTO JOINED INDEXSETstatement for eachindexset, except for the indexset at the top of the join hierarchy,which automatically uses the data from its indexset column indexes.(Sybase IQ tells you which is the top indexset in the join hierarchywhen you create the joined indexset; see the discussion later in thiscommand and in the IQ CREATE JOINED INDEXSETcommand for moreinformation.)
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
18/40
10 Commands
IQ INSERT INTO JOINED INDEXSET Sybase IQ Release 11.2.x
Syntax
IQ INSERT INTO JOINED INDEXSET
[[[indexspace].][owner].]joined_indexset_name
FOR [[[indexspace].][owner].]indexset_name
[[WITH]insert_load_option
[,insert_load_option]...]
{table-or-indexset-clause|flat-file-clause}
insert_load_option=
{BLOCKFACTOR =#
| BLOCKSIZE =#
| BYTEORDER = {NATIVE | HIGHORDER | LOWORDER}
| LIMIT =max_#_of_records_to_read
| MBSORT =#_of_MB_memory_for_sort
| NOTIFY =notify_every_#_of_rows| ONFILEERROR = {ROLLBACK | COMMIT | CONTINUE}
| PREVIEW
| ROWTERMINATOR = 'delimiter_string'
| SKIP =#_of_rows_to_skip
| STARTRECID =#}
table-or-indexset-clause=
[USING ATTACHED [{DATABASE | DB}]]SELECT-statement
flat-file-clause=
USING 'input_file'[, 'input_file']...
({column_name[insert_conversion_option
[,insert_conversion_option]...]
| FILLER(field_descriptor)}
[, {column_name[insert_conversion_option [,insert_conversion_option]...]
| FILLER(field_descriptor)}]...)
[[WITH]insert_load_option
[, insert_load_option]...]
insert_conversion_option=
{ASCII (field_descriptor)
| DATE ('input_date_format')
| DATETIME ('input_date/time_format')
| NULLS ({BLANKS | ZEROS | 'literal'
[, 'literal']...})}
field_descriptor=
{input_width| PREFIX1 | PREFIX2 | PREFIX4
| 'delimiter_string'}
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
19/40
Sybase IQ Quick Reference 11
Sybase IQ Release 11.2.x IQ PASS
IQ PASS
Sybase IQ ignores the string that follows the PASSkeyword andpasses it through to SQL Server for processing.
Syntax
IQ PASSrest_of_line
IQ RESTORE
Restores a Sybase IQ indexspace and associated catalog information(full restore) or the indexspace only (partial restore). You can also usethis command to display the header information for the indexspacewithout performing any restore operation. You must be either theDatabase Owner or have 'sa' role to use this statement.
Each backup set includes at least three different archive media(tapes, for example):
One or more for indexspace files (segments and Free List files)
One or more for the Backup Server archive (the catalog tables)
One for the IQ MASTER archive (header files that describe theindexspace backed up)
A full restore prompts you to mount the IQ MASTER archive first,then the Backup Server archive, followed by archive(s) containing
indexspace data in any order. A partial restore prompts you to mountthe IQ MASTER archive first, then the archive(s) containingindexspace data in any order.
Syntax
IQ RESTORE INDEXSPACEindexspace_name
FROM {archive_deviceHEADERONLY |
archive_device[FROMarchive_device]...
[FILEoldpath[TOnewpath]]...}
IQ SET (Administration)
Used to reset Sybase IQ default settings. For some options, you canspecify the SERVERDEFAULTkeyword with the IQ SETcommand, whichsaves the value in the SQL Server table11sysIQ_controlas apersistent, server-wide default value. When no keyword or the
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
20/40
12 Commands
IQ SET (Administration) Sybase IQ Release 11.2.x
SESSIONkeyword is given, the IQ SETcommand only affects thecurrent session.
All IQ SEToptions have a security level (choices are SystemAdministrator, Database Owner, and PUBLIC) assigned with them.For example, you must have the System Administrator role tospecify a SERVERDEFAULToption.
Syntax
IQ SET
{[SERVERDEFAULT | SESSION]server_session_options |
[SESSION]session_only_options}
server_session_options=
{DATEFORMATOUTPUTdate_format|
DATETIMEFORMATOUTPUTdatetime_format|
DDLINFO {ON | OFF} |
DISKSTRIPING {ON | OFF | RAWDETECT} |
INFOMESSAGES {ON | OFF} |
KEEPOPENIQLOG {ON | OFF} |
MBSORT#_of_MB_mem_for_sort|
OPTIMIZEFORTHISMANYUSERS#_of_users|
OUTOFDISKMSGREPEATrepeat_msg_every_seconds|
OUTOFDISKWAITTIMEseconds_to_wait|
QUERYINFO {ON | OFF} |
REMOVEINDEXSPACELOG {ON | OFF} |
SHMEMMB#_MB_for_main_buffer_cache|
STRIPINGDENSITY#_of_stripes|
SYSTEMSHMMAX#_of_MB|SYSTEMSHMSEGmax_segments|
TEMPSHMEMMB#_MB_for_private_buffer_cache|
TRACKEXCESSREADS {ON | OFF}}
USERETRYMSGREPEAT#_of_times|
USERETRYWAITTIME#_of_seconds}
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
21/40
Sybase IQ Quick Reference 13
Sybase IQ Release 11.2.x IQ SET (Query Processing)
session_only_options=
{BLOCKFACTOR#_of_records_per_block|
BLOCKSIZE#_of_bytes_per_block|
COMMIT#_of_commits_for_delete|
ESTIMATEDRECORDCOUNT#_of_records|
INSERTNUMMTBUFFERS#_of_buffers|
INSERTNUMROWSPERBUFFER#_of_rows|
IQ {ON | OFF | ONLY} |
LIMITmax_#_of_records_to_read|
MAXWARNINGSmax_#_of_warnings|
NOTIFYnotify_every_#_of_rows|
PREVIEW |
SHOWELAPSEDTIME {ON | OFF} |
SKIP#_of_rows_to_skip|
STARTRECIDrow_record_id_#|SUPPORTALL8BITCHAR {ON | OFF}}
IQ SET (Query Processing)
Sets query processing options for Sybase IQ and/or SQL Server forthe duration of the work session. Can be used to set some optionsinside a trigger or stored procedure. Those options that requiresystem privileges are described in IQ SET (Administration) onpage -11.
Syntax
IQ SET{[SERVERDEFAULT | SESSION]server_session_options |
[SESSION]session_only_options}
server_session_options=
{AGGREGATIONCUTOFFprecision_#|
{INFOMESSAGES {ON | OFF}
JOINOPTIMIZATION {ON | OFF} |
JOINORDERLEFTDEEP {ON | OFF} |
KEEPOPENIQLOG {ON | OFF} |
MAXCARTESIANRESULT#_of_rows|
SHOWIQROWID {ON | OFF}}
session_only_options=
{ANSINULL {ON | OFF} |
ARITHABORT [{ARITH_OVERFLOW | NUMERIC_TRUNCATION}] {ON | OFF} |
ARITHIGNORE [ARITH_OVERFLOW] {ON | OFF} |
NOEXEC {ON | OFF} |
ROWCOUNT#_of_rows}
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
22/40
14 Commands
IQ SHOW INDEXSET Sybase IQ Release 11.2.x
IQ SHOW INDEXSET
Displays information about the named indexset. The informationincludes the column names, the datatypes, the column length,precision, scale, whether or not the column allows NULLs, and so on.
Syntax
IQ SHOW INDEXSET FOR
[[[indexspace].][owner].]indexset_name
IQ SHOW INDEXSET INDEXES
Displays information about indexes on the columns in the specifiedindexset. The information includes the index names, type of index,column names, and uniqueness setting.
Syntax
IQ SHOW INDEXSET {INDEXES | INDICES}
FOR [[[indexspace].][owner].]indexset_name
IQ SHOW INDEXSET JOINED INDEXSETS
Displays information about the joined indexsets associated with thespecified indexset. The information includes the name and joinrelationships of each joined indexset.
Syntax
IQ SHOW INDEXSET JOINED INDEXSETS
FOR [[[indexspace].][owner].]indexset_name
IQ SHOW INDEXSPACE
Displays information about the indexspace you are using. Theinformation includes the name of the indexspace and a listing of theindexsets that are part of that indexspace. The table listing includesthe creation and last update time of and the number of columns ineach indexset.
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
23/40
Sybase IQ Quick Reference 15
Sybase IQ Release 11.2.x IQ SHOW INDEXSPACE INDEXES
Syntax
IQ SHOW [{PRIVATE | MAIN}]
{INDEXSETS | INDEXSPACE [STATS | STATISTICS]}
IQ SHOW INDEXSPACE INDEXES
Displays information about the column indexes associated with theSybase IQ indexspace you are using. The information includes thename and type of each index, the indexsets and columns from whichthey are derived, and other data such as uniqueness.
Syntax
IQ SHOW [{PRIVATE | MAIN}] [{INDEXSPACE | INDEXSETS}]
{INDEXES | INDICES}
[[[[indexspace].][owner].]indexset_name]
IQ SHOW INDEXSPACE JOINED INDEXSETS
Displays information about the joined indexsets associated with theSybase IQ indexspace you are using. The information includes thename and join relationships of each joined indexset.
Syntax
IQ SHOW [{PRIVATE | MAIN}] [{INDEXSPACE | INDEXSETS}]JOINED {INDEXSET | INDEXSETS}
[[[[indexspace].][owner].]joined_indexset_name]
IQ SHOW SET VALUES
Displays an alphabetized list of theIQ SETcommand options andtheir values.
Syntax
IQ SHOW SET VALUES
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
24/40
16 Commands
IQ SHOW...SIZE Sybase IQ Release 11.2.x
IQ SHOW...SIZE
Displays the size, in blocks, of the specified indexspace object. Theobject can be a column index, a joined indexset, an indexset, or anindexspace.
Syntax
IQ SHOW INDEX SIZEindex_name
IQ SHOW INDEXSET SIZE
FOR [[[indexspace].][owner].]indexset_name
IQ SHOW JOINED INDEXSET SIZE
[[[indexspace].][owner].]join_index_name
IQ SHOW [{PRIVATE | MAIN}] INDEXSPACE SIZE
IQ STATUS
Shows information about the current indexspace (for any you openwith the USEcommand), including the release of Sybase IQ invoked,the indexspace name, creation date, blocksize, number of blocksused, buffers used, number of segments, private indexspace name,
transaction image files (if the indexspace is open RW), and themaximum TI block usage.
Syntax
IQ STATUS
ORDER BY Clause
Sorts the result table output from a SELECTstatement by column.
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
25/40
Sybase IQ Quick Reference 17
Sybase IQ Release 11.2.x Query Expression
Syntax
[ORDER BY
{[[[indexspace].][owner].indexset_name.]column_name
|select_list_number} [ASC | DESC]
[, {[[[indexspace].][owner].indexset_name.]
column_name]
|select_list_number} [ASC | DESC]]...
Query Expression
An expression (consisting of one or more query specifications) thatcan be used in IQ DELETE, IQ INSERT, or SELECTstatements. The query
expression creates a virtual table to be retrieved from or stored in theindexspace. The query expression differs from the SELECTstatementin that it cannot be used by itself and it is allowed to return more thanone row.
Syntax
{query_expression| (SELECT_statement)}
[UNION [ALL] {query_expression|
(SELECT_statement)}]...
[ORDER BY clause]
Search Conditions
Combines predicates used with the logical operators (AND, ORandNOT) to filter the rows or groups returned by the correspondingWHERE, GROUP BY,or HAVINGclause. Search conditions help defineSELECTstatement criteria.
Syntax
predicate=
{[NOT]search_condition
|search_conditionANDsearch_condition
|search_conditionORsearch_condition}
SELECTRetrieves rows and columns from indexsets in the indexspace. Usethe SELECTcommand to perform queries in interactive Sybase IQ.
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
26/40
18 Commands
SHUTDOWN Sybase IQ Release 11.2.x
Syntax
SELECT [ALL | DISTINCT]select_list
FROM clause
[WHERE clause]
[GROUP BY clause]
[HAVING clause]
[ORDER BY clause]
SHUTDOWN
Exit Sybase IQ and pass the shutdowncommand to the SQL Server.This command can only be issued by a System Administrator.
Syntax
SHUTDOWN [with {wait | nowait}]
USE
Opens the attached indexspace and corresponding Sybase IQindexspace, if one exists, for use.
The attached database is opened for read/write use by default.Parameters read from thesysIQ_loginstable control how the SybaseIQ indexspace will be opened.
Syntax
USEindexspace_name
WHERE Clause
Sets the conditions for the rows that are retrieved by a SELECTstatement.
Syntax
[WHEREsearch_condition]
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
27/40
0.
Sybase IQ Quick Reference 19
Stored Procedures 0.
sp_IQAddLogin
Adds or modifies an entry in theIQmaster..sysIQ_loginstable. Thisprocedure grants usage permissions to a user login for a particularindexspace.
Syntax
sp_IQAddLoginname,dbname,rwdbname,nbuffers,
ntmpbuffers,logfile,attacheddb,
attacheddbserver,attacheddbservertype,accessmode
sp_IQAddLogins
Adds or modifies an entry in theIQmaster..sysIQ_loginstable for aparticular main indexspace and group(s) of users.
Syntax
sp_IQAddLoginsgrpname,dbname,rwdbname,nbuffers,
ntmpbuffers,logfile,attacheddb,
attacheddbserver,attacheddbservertype,accessmode
sp_IQDropBadSegment
Removes the highest numbered segment from the specifiedindexspace, if the segment is corrupted.
Syntax
sp_IQDropBadSegmentdbname
sp_IQDropLogin
Removes an entry in theIQmaster..sysIQ_logins table for a user on a
particular indexspace.
Syntax
sp_IQDropLoginname,dbname
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
28/40
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
29/40
Sybase IQ Quick Reference 21
Sybase IQ Release 11.2.x sp_IQEstSegments
sp_IQEstSegments
Estimates the number of segments to create for the initial build of theindexspace, and the size of each segment, based on the size of theunderlying database and specified restrictions on segment size.
Syntax
sp_IQEstSegmentsidx_size[,block_size[,min_size
[,max_size]]]
sp_IQEstSpace
Estimates the amount of space that an index will require, based onthe number of rows in the tables in the underlying database. Thiscommand includes some of the same information shown bysp_IQEstSegment.
Syntax
sp_IQEstSpacetabname, num_rows [, block_size]
sp_IQRenameIndexSpace
Renames an IQ object by updating_DBNamewith the new objectname in all Sybase IQ tables.
Syntax
sp_IQRenameIndexSpaceoldname, newname
sp_IQRenamePath
Renames a partial substring or an absolute path name to allow thesystem catalog to point to Sybase IQ files (such as indexspace and.TIfiles) that you have moved.
Syntax
sp_IQRenamePathindexspace_name,"oldpath", "newpath"
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
30/40
22 Stored Procedures
sp_IQRestartHungIndexSpace Sybase IQ Release 11.2.x
sp_IQRestartHungIndexSpace
Restarts an indexspace that is hung because it was out of disk spaceUse this procedure after disk space has been provided.
Syntax
sp_IQRestartHungIndexSpacedbname
sp_IQSetSharedMemory
Alters the buffer cache shared memory settings for an existingSybase IQ indexspace. The new settings take effect the next time ashared segment is created. It will not affect current users of theindexspace.
Syntax
sp_IQSetSharedMemoryindexspacename,shmemmb_value,
tempshmemmb_value
sp_IQShowBadLogins
Shows entries inIQmaster..sysIQ_loginsthat are unusable. Unusableentries might result, for example, if the indexspace or user no longerexists.
Syntax
sp_IQShowBadLogins
sp_IQShowFileFormat
Shows current file format (revision level) of Sybase IQ files.
Syntax
sp_IQShowFileFormat
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
31/40
Sybase IQ Quick Reference 23
Sybase IQ Release 11.2.x sp_IQShowFileFormatSp
sp_IQShowFileFormatSp
Shows current file format (revision level) of Sybase IQ storedprocedures.
Syntax
sp_IQShowFileFormatSp
sp_IQShowFileFormatSys
Shows current file format (revision level) of Sybase IQ system tables.
Syntax
sp_IQShowFileFormatSys
sp_IQShowHungIndexSpaces
Shows the names of indexspaces that are hung because they are outof disk space.
Syntax
sp_IQShowHungIndexSpaces
sp_IQShowIndexSegments
Shows all segments for a particular indexspace.
Syntax
sp_IQShowIndexSegments dbname
sp_IQShowIndexSpaces
Shows all indexspaces in the catalog and their in use status,including whether they are hung.
Syntax
sp_IQShowIndexSpaces
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
32/40
24 Stored Procedures
sp_IQShowLogins Sybase IQ Release 11.2.x
sp_IQShowLogins
Shows all active login records for existing indexspaces.
Syntax
sp_IQShowLogins
sp_IQShowUsers
Shows all active users of Sybase IQ which indexspaces they areusing, lock mode, and where they are connected from.
Syntax
sp_IQShowUsers
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
33/40
0.
Sybase IQ Quick Reference 25
Functions 0.
AVG
Returns the average value of argument. NULL values are notincluded. AVGis valid for integer and floating point datatypes.
Syntax
AVG([ALL | DISTINCT]argument)
CAST
Used in the WHEREclause or select list of a SELECTstatement toconvert one datatype to another. It can also be used to obtain avariety of date/time formats if you convertDATEorDATETIMEcolumns toCHARorVARCHAR.
Syntax
CAST ( AS [,"datestyle"])
CONVERT
This function can change expressions from one datatype to anotherand specify new display formats for date/time information. It can beused in the select list, in the whereclause, and anywhere else anexpression is allowed.
Syntax
CONVERT (datatype[(length) | (precision[,scale])],
expression[,style])
COUNT
Returns the number of rows that satisfies the query. Rows with
NULL values in the specified column are not included.
Syntax
COUNT([ALL | DISTINCT]argument)
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
34/40
26 Functions
COUNT(*) Sybase IQ Release 11.2.x
COUNT(*)
Returns the number of rows that satisfies the query, including nullsand duplicates.
Syntax
COUNT(*)
DATEADD
Adds an interval to a specified date and returns a datetime valueequal to the date plus the number of date parts.
Syntax
DATEADD(datepart,integer_expression, date_expression)
DATEDIFF
Returns the number of date parts between two specified dates.
Syntax
DATEDIFF(datepart,date_expression 1,
date_expression 2)
DATEPART
Returns an integer value for the specified date part (the firstargument) of the specifiedDATEorDATETIMEvalue (the secondargument).
Syntax
DATEPART(datepart,value_expression)
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
35/40
Sybase IQ Quick Reference 27
Sybase IQ Release 11.2.x DIFFERENCE
DIFFERENCE
Returns an integer representing the difference between two SOUNDEXvalues.
Syntax
DIFFERENCE(char_expr1, char_expr2)
LEFT
Returns the leftmost number of characters (defined byinteger_expr)from a character expression (defined bychar_expr). Return value hasthe same datatype as the character expression.
Syntax
LEFT(char_expr, integer_expr)
LENGTH or DATALENGTH
Returns the length in bytes of the character expression.
Syntax
LENGTH(char_expr)
DATALENGTH(char_expr)
LOWER or LCASE
Converts uppercase to lowercase, returning a character value.
Syntax
LOWER(char_expr)
LCASE(char_expr)
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
36/40
28 Functions
LTRIM Sybase IQ Release 11.2.x
LTRIM
Removes leading blanks from the character expression. Only valuesequivalent to the space character in the current character set areremoved.
Syntax
LTRIM(char_expr)
MAX
Returns the maximum value ofargument. NULL values are notincluded. MAXis valid for integer and number type fields, character,floating point, and date/time columns. With character columns,MAXfinds the highest value in the sort sequence. TheDISTINCToption is notused with MAX, because it is not meaningful in this context.
Syntax
MAX(argument)
MIN
Returns the minimum value ofargument.NULL values are notincluded. MINis valid for integer and number type fields, character,floating point, and date/time columns. With character columns, MINfinds the lowest value in the sort sequence. TheDISTINCToption is notused with MIN, because it is not meaningful in this context.
Syntax
MIN(argument)
RIGHT
Returns the rightmost number of characters (defined by integer_expr)from a character expression (defined bychar_expr). Return value has
the same datatype as the character expression.
Syntax
RIGHT(char_expr, integer_expr)
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
37/40
Sybase IQ Quick Reference 29
Sybase IQ Release 11.2.x ROUND
ROUND
Rounds a numeric expression (up or down) so that it has thespecifiedinteger_expression number of significant digits.
Syntax
ROUND(numval_expression,integer_expression)
RTRIM
Removes trailing blanks. Only values equivalent to the spacecharacter in the current character set are removed.
Syntax
RTRIM(char_expr)
SIMILAR
Returns an integer between 0 and 100 representing (in percentage)the similarity between the two strings.
Syntax
SIMILAR(char_expr1, char_expr2)
SOUNDEX
Returns a four-character soundex code for character strings that arecomposed of a contiguous sequence of valid single-byte romanletters.
Syntax
SOUNDEX(char_expr)
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
38/40
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
39/40
Sybase IQ Quick Reference 31
Sybase IQ Release 11.2.x SUSER_NAME
SUSER_NAME
Used in the select list or WHEREclause of a SELECTstatement to returnthe ID number and login name of the server user fromsyslogins.
Syntax
SUSER_NAME ([server_user_id])
TRIM
Removes leading andtrailing blanks. Only values equivalent to thespace character in the current character set are removed
Syntax
TRIM(char_expr)
UPPER or UCASE
Converts lowercase to uppercase, returning a character value.
Syntax
UPPER(char_expr)
UCASE(char_expr)
8/14/2019 SYBASE_IQ_QUICK Reference.pdf
40/40
32 Functions
UPPER or UCASE Sybase IQ Release 11.2.x