Brief Sybase Syntax
DB-Library/C
a
abort_xact - Mark a distributed transaction as being aborted.
RETCODE abort_xact(connect, commid)
DBPROCESS *connect;
DBINT commid;
b
bcp_batch - Save any preceding rows in SQL Server.
DBINT bcp_batch(dbproc)
DBPROCESS *dbproc;
bcp_bind - Bind data from a program variable to a SQL Server table.
RETCODE bcp_bind (dbproc, varaddr, prefixlen, varlen,
terminator, termlen, type, table_column)
DBPROCESS *dbproc;
BYTE *varaddr;
int prefixlen;
DBINT varlen;
BYTE *terminator;
int termlen;
int type;
int table_column;
bcp_colfmt - Specify the format of a host file for bulk copy purposes.
RETCODE bcp_colfmt (dbproc, host_colnum, host_type,
host_prefixlen, host_collen, host_term,
host_termlen, table_colnum)
DBPROCESS *dbproc;
int host_colnum;
int host_type;
int host_prefixlen;
DBINT host_collen;
BYTE *host_term;
int host_termlen;
int table_colnum;
bcp_collen - Set the program variable data length for the current copy IN.
RETCODE bcp_collen(dbproc, varlen, table_column)
DBPROCESS *dbproc;
DBINT varlen;
int table_column;
bcp_colptr - Set the program variable data address for the current copy IN.
RETCODE bcp_colptr(dbproc, colptr, table_column)
DBPROCESS *dbproc;
BYTE *colptr;
int table_column;
bcp_columns - Set the total number of columns found in the host file.
RETCODE bcp_columns(dbproc, host_colcount)
DBPROCESS *dbproc;
int host_colcount;
bcp_control - Change various control parameter default settings.
RETCODE bcp_control(dbproc, field, value)
DBPROCESS *dbproc;
int field;
DBINT value;
bcp_done - End a bulk copy from program variables into SQL Server.
DBINT bcp_done(dbproc)
DBPROCESS *dbproc;
bcp_exec - Execute a bulk copy of data between a database table and a host file.
RETCODE bcp_exec(dbproc, rows_copied)
DBPROCESS *dbproc;
DBINT *rows_copied;
bcp_getl - Determine if the LOGINREC has been set for bulk copy operations.
DBBOOL bcp_getl(loginrec)
LOGINREC *loginrec;
bcp_init - Initialize bulk copy.
RETCODE bcp_init(dbproc, tblname, hfile, errfile, direction)
DBPROCESS *dbproc;
char *tblname;
char *hfile;
char *errfile;
int direction;
bcp_moretext - Send part of a text or image value to SQL Server.
RETCODE bcp_moretext(dbproc, size, text)
DBPROCESS *dbproc;
DBINT size;
BYTE *text;
bcp_readfmt - Read a datafile format definition from a host file.
RETCODE bcp_readfmt(dbproc, filename)
DBPROCESS *dbproc;
char *filename;
bcp_sendrow - Send a row of data from program variables to SQL Server.
RETCODE bcp_sendrow(dbproc)
DBPROCESS *dbproc;
BCP_SETL - Set the LOGINREC for bulk copy copy in operations.
RETCODE BCP_SETL(loginrec, enable)
LOGINREC *loginrec;
DBBOOL enable;
bcp_setxlate - Specify the character set translations to use when retrieving data from or inserting data into a SQL Server.
RETCODE bcp_setxlate(dbproc, xlt_tosrv, xlt_todisp)
DBPROCESS *dbproc;
DBXLATE *xlt_tosrv;
DBXLATE *xlt_todisp;
bcp_writefmt - Write a datafile format definition to a host file.
RETCODE bcp_writefmt(dbproc, filename)
DBPROCESS *dbproc;
char *filename;
build_xact_string - Build a name for a distributed transaction.
void build_xact_string(xact_name, service_name,
commid, result)
char *xact_name;
char *service_name;
DBINT commid;
char *result;
c
close_commit - End a connection with the commit service.
void close_commit(connect)
DBPROCESS *connect;
commit_xact - Mark a distributed transaction as being committed.
RETCODE commit_xact(connect, commid)
DBPROCESS *connect;
DBINT commid;
d
db12hour - Determine whether the specified language uses 12-hour or 24-hour time.
DBBOOL db12hour(dbproc, language)
DBPROCESS *dbproc;
char *language;
dbadata - Return a pointer to the data for a compute column.
BYTE *dbadata(dbproc, computeid, column)
DBPROCESS *dbproc;
int computeid;
int column;
dbadlen - Return the actual length of the data for a compute column.
DBINT dbadlen(dbproc, computeid, column)
DBPROCESS *dbproc;
int computeid;
int column;
dbaltbind - Bind a compute column to a program variable.
RETCODE dbaltbind(dbproc, computeid, column, vartype,
varlen, varaddr)
DBPROCESS *dbproc;
int computeid;
int column;
int vartype;
DBINT varlen;
BYTE *varaddr;
dbaltcolid - Return the column id for a compute column.
int dbaltcolid(dbproc, computeid, column)
DBPROCESS *dbproc;
int computeid;
int column;
dbaltlen - Return the maximum length of the data for a particular compute column.
DBINT dbaltlen(dbproc, computeid, column)
DBPROCESS *dbproc;
int computeid;
int column;
dbaltop - Return the type of aggregate operator for a particular compute column.
int dbaltop(dbproc, computeid, column)
DBPROCESS *dbproc;
int computeid;
int column;
dbalttype - Return the datatype for a compute column.
int dbalttype(dbproc, computeid, column)
DBPROCESS *dbproc;
int computeid;
int column;
dbaltutype - Return the user-defined datatype for a compute column.
DBINT dbaltutype(dbproc, computeid, column)
DBPROCESS *dbproc;
int computeid;
int column;
dbanullbind - Associate an indicator variable with a compute-row column.
RETCODE dbanullbind(dbproc, computeid, column,
indicator)
DBPROCESS *dbproc;
int computeid;
int column;
DBINT *indicator;
dbbind - Bind a regular result column to a program variable.
RETCODE dbbind(dbproc, column, vartype, varlen, varaddr)
DBPROCESS *dbproc;
int column;
int vartype;
DBINT varlen;
BYTE *varaddr;
dbbufsize - Return the size of a DBPROCESS row buffer.
int dbbufsize(dbproc)
DBPROCESS *dbproc;
dbbylist - Return the bylist for a compute row.
BYTE *dbbylist(dbproc, computeid, size)
DBPROCESS *dbproc;
int computeid;
int *size;
dbcancel - Cancel the current command batch.
RETCODE dbcancel(dbproc)
DBPROCESS *dbproc;
dbcancel_a (VMS only) - Cancel the current command batch.
RETCODE dbcancel_a(dbproc, final_result, ast_proc,
ast_param)
DBPROCESS *dbproc;
RETCODE *final_result;
void (*ast_proc)();
BYTE *ast_param;
dbcanquery - Cancel any rows pending from the most recently executed query.
RETCODE dbcanquery(dbproc)
DBPROCESS *dbproc;
dbcanquery_a (VMS only) - Cancel any rows pending from the most recently executed query.
RETCODE dbcanquery_a(dbproc, final_result, ast_proc,
ast_param)
DBPROCESS *dbproc;
RETCODE *final_result;
void (*ast_proc)();
BYTE *ast_param;
dbchange - Determine whether a command batch has changed the current database.
char *dbchange(dbproc)
DBPROCESS *dbproc;
dbcharsetconv - Indicate whether the server is performing character set translation.
DBBOOL dbcharsetconv(dbproc)
DBPROCESS *dbproc;
dbclose - Close and de-allocate a single DBPROCESS structure.
void dbclose(dbproc)
DBPROCESS *dbproc;
dbclrbuf - Drop rows from the row buffer.
void dbclrbuf(dbproc, n)
DBPROCESS *dbproc;
DBINT n;
dbclropt - Clear an option set by dbsetopt().
RETCODE dbclropt(dbproc, option, param)
DBPROCESS *dbproc;
int option;
char *param;
dbcmd - Add text to the DBPROCESS command buffer.
RETCODE dbcmd(dbproc, cmdstring)
DBPROCESS *dbproc;
char *cmdstring;
DBCMDROW - Determine whether the current command can return rows.
RETCODE DBCMDROW(dbproc)
DBPROCESS *dbproc;
dbcolbrowse - Determine whether the source of a regular result column is updatable via the DB-Library browse-mode facilities.
DBBOOL dbcolbrowse(dbproc, colnum)
DBPROCESS *dbproc;
int colnum;
dbcollen - Return the maximum length of the data in a regular result column.
DBINT dbcollen(dbproc, column)
DBPROCESS *dbproc;
int column;
dbcolname - Return the name of a regular result column.
char *dbcolname(dbproc, column)
DBPROCESS *dbproc;
int column;
dbcolsource - Return a pointer to the name of the database column from which the specified regular result column was derived.
char *dbcolsource(dbproc, colnum)
DBPROCESS *dbproc;
int colnum;
dbcoltype - Return the datatype for a regular result column.
int dbcoltype(dbproc, column)
DBPROCESS *dbproc;
int column;
dbcolutype - Return the user-defined datatype for a regular result column.
DBINT dbcolutype(dbproc, column)
DBPROCESS *dbproc;
int column;
dbconvert - Convert data from one datatype to another.
DBINT dbconvert(dbproc, srctype, src, srclen,
desttype, dest, destlen)
DBPROCESS *dbproc;
int srctype;
BYTE *src;
DBINT srclen;
int desttype;
BYTE *dest;
DBINT destlen;
DBCOUNT - Return the number of rows affected by a Transact-SQL command.
DBINT DBCOUNT(dbproc)
DBPROCESS *dbproc;
DBCURCMD - Return the number of the current command.
int DBCURCMD(dbproc)
DBPROCESS *dbproc;
DBCURROW - Return the number of the row currently being read.
DBINT DBCURROW(dbproc)
DBPROCESS *dbproc;
dbdata - Return a pointer to the data in a regular result column.
BYTE *dbdata(dbproc, column)
DBPROCESS *dbproc;
int column;
dbdate4cmp - Compare two DBDATETIME4 values.
int dbdate4cmp(dbproc, d1, d2)
DBPROCESS *dbproc;
DBDATETIME4 *d1;
DBDATETIME4 *d2;
dbdate4zero - Initialize a DBDATETIME4 variable to Jan 1, 1900 12:00AM.
RETCODE dbdate4zero(dbproc, dateptr)
DBPROCESS *dbproc;
DBDATETIME4 *dateptr;
dbdatechar - Convert an integer component of a DBDATETIME value into character format.
RETCODE dbdatechar(dbproc, charbuf, datepart, value)
DBPROCESS *dbproc;
char *charbuf;
int datepart;
int value;
dbdatecmp - Compare two DBDATETIME values.
int dbdatecmp(dbproc, d1, d2)
DBPROCESS *dbproc;
DBDATETIME *d1;
DBDATETIME *d2;
dbdatecrack - Convert a machine-readable DBDATETIME value into user- accessible format.
RETCODE dbdatecrack(dbproc, dateinfo, datetime)
DBPROCESS *dbproc;
DBDATEREC *dateinfo;
DBDATETIME *datetime;
dbdatename - Convert the specified component of a DBDATETIME structure into its corresponding character string.
int dbdatename(dbproc, charbuf, datepart, datetime)
DBPROCESS *dbproc;
char *charbuf;
int datepart;
DBDATETIME *datetime;
dbdateorder - Return the date component order for a given language.
char *dbdateorder(dbproc, language)
DBPROCESS *dbproc;
char *language;
dbdatepart - Return the specified part of a DBDATETIME value as a numeric value.
DBINT dbdatepart(dbproc, datepart, datetime)
DBPROCESS *dbproc;
int datepart;
DBDATETIME *datetime;
dbdatezero - Initialize a DBDATETIME value to Jan 1, 1900 12:00:00:000AM.
RETCODE dbdatezero(dbproc, dateptr)
DBPROCESS *dbproc;
DBDATETIME *dateptr;
dbdatlen - Return the length of the data in a regular result column.
DBINT dbdatlen(dbproc, column)
DBPROCESS *dbproc;
int column;
dbdayname - Determine the name of a specified weekday in a specified language.
char *dbdayname(dbproc, language, daynum)
DBPROCESS *dbproc;
char *language;
int daynum;
DBDEAD - Determine whether a particular DBPROCESS is dead.
DBBOOL DBDEAD(dbproc)
DBPROCESS *dbproc;
dberrhandle - Install a user function to handle DB-Library errors.
int (*dberrhandle(handler))()
int (*handler)();
dbexit - Close and de-allocate all DBPROCESS structures, and clean up any structures initialized by dbinit().
void dbexit()
dbfcmd - Add text to the DBPROCESS command buffer using C run-time library sprintf-type formatting.
RETCODE dbfcmd(dbproc, cmdstring, args...)
DBPROCESS *dbproc;
char *cmdstring;
long args...;
DBFIRSTROW - Return the number of the first row in the row buffer.
DBINT DBFIRSTROW(dbproc)
DBPROCESS *dbproc;
dbfree_xlate - Free a pair of character set translation tables.
RETCODE *dbfree_xlate(dbproc, xlt_tosrv, xlt_todisp)
DBPROCESS *dbproc;
DBXLATE *xlt_tosrv;
DBXLATE *xlt_todisp;
dbfreebuf - Clear the command buffer.
void dbfreebuf(dbproc)
DBPROCESS *dbproc;
dbfreequal - Free the memory allocated by dbqual().
void dbfreequal(qualptr)
char *qualptr;
dbfreesort - Free a sort order structure allocated by dbloadsort().
RETCODE dbfreesort(dbproc, sortorder)
DBPROCESS *dbproc;
DBSORTORDER *sortorder;
dbgetchar - Return a pointer to a character in the command buffer.
char *dbgetchar(dbproc, n)
DBPROCESS *dbproc;
int n;
dbgetcharset - Get the name of the client character set from the DBPROCESS structure.
char *dbgetcharset(dbproc)
DBPROCESS *dbproc;
dbgetloginfo - Transfer TDS login response information from a DBPROCESS structure to a newly-allocated DBLOGINFO structure.
RETCODE dbgetloginfo(dbproc, loginfo)
DBPROCESS *dbproc;
DBLOGINFO **loginfo;
dbgetlusername - Return the user name from a LOGINREC structure.
int dbgetlusername(login, name_buffer, buffer_len)
LOGINREC *login;
BYTE *name_buffer;
int buffer_len;
dbgetmaxprocs - Determine the current maximum number of simultaneously open DBPROCESSes.
int dbgetmaxprocs()
dbgetnatlang - Get the national language from the DBPROCESS structure.
char* dbgetnatlang(dbproc)
DBPROCESS *dbproc;
dbgetoff - Check for the existence of Transact-SQL constructs in the command buffer.
int dbgetoff(dbproc, offtype, startfrom)
DBPROCESS *dbproc;
DBUSMALLINT offtype;
int startfrom;
dbgetpacket - Return the TDS packet size currently in use.
int dbgetpacket(dbproc)
DBPROCESS *dbproc;
dbgetrow - Read the specified row in the row buffer.
STATUS dbgetrow(dbproc, row)
DBPROCESS *dbproc;
DBINT row;
DBGETTIME - Return the number of seconds that DB-Library will wait for a server response to a SQL command.
int DBGETTIME()
dbgetuserdata - Return a pointer to user-allocated data from a DBPROCESS structure.
BYTE *dbgetuserdata(dbproc)
DBPROCESS *dbproc;
dbhasretstat - Determine whether the current command or remote procedure call generated a return status number.
DBBOOL dbhasretstat(dbproc)
DBPROCESS *dbproc;
dbinit - Initialize DB-Library.
RETCODE dbinit()
DBIORDESC (UNIX and AOS/VS only) - Provide program access to the UNIX or AOS/VS file descriptor used by a DBPROCESS to read data coming from the server.
int DBIORDESC(dbproc)
DBPROCESS *dbproc;
DBIOWDESC (UNIX and AOS/VS only) - Provide program access to the UNIX or AOS/VS file descriptor used by a DBPROCESS to write data to the server.
int DBIOWDESC(dbproc)
DBPROCESS *dbproc;
DBISAVAIL - Determine whether a DBPROCESS is available for general use.
DBBOOL DBISAVAIL(dbproc)
DBPROCESS *dbproc;
dbisopt - Check the status of a server or DB-Library option.
DBBOOL dbisopt(dbproc, option, param)
DBPROCESS *dbproc;
int option;
char *param;
DBLASTROW - Return the number of the last row in the row buffer.
DBINT DBLASTROW(dbproc)
DBPROCESS *dbproc;
dbload_xlate - Load a pair of character set translation tables.
RETCODE dbload_xlate(dbproc, srv_charset, xlate_name,
xlt_tosrv, xlt_todisp)
DBPROCESS *dbproc;
char *srv_charset;
char *xlt_name;
DBXLATE **xlt_tosrv;
DBXLATE **xlt_todisp;
dbloadsort - Load a server sort order.
DBSORTORDER *dbloadsort(dbproc)
DBPROCESS *dbproc;
dblogin - Allocate a login record for use in dbopen().
LOGINREC *dblogin()
dbloginfree - Free a login record.
void dbloginfree(loginptr)
LOGINREC *loginptr;
dbmny4add - Add two DBMONEY4 values.
RETCODE dbmny4add(dbproc, m1, m2, sum)
DBPROCESS *dbproc;
DBMONEY4 *m1;
DBMONEY4 *m2;
DBMONEY4 *sum;
dbmny4cmp - Compare two DBMONEY4 values.
int dbmny4cmp(dbproc, m1, m2)
DBPROCESS *dbproc;
DBMONEY4 *m1;
DBMONEY4 *m2;
dbmny4copy - Copy a DBMONEY4 value.
RETCODE dbmny4copy(dbproc, src, dest)
DBPROCESS *dbproc;
DBMONEY4 *src;
DBMONEY4 *dest;
dbmny4divide - Divide one DBMONEY4 value by another.
RETCODE dbmny4divide(dbproc, m1, m2, quotient)
DBPROCESS *dbproc;
DBMONEY4 *m1;
DBMONEY4 *m2;
DBMONEY4 *quotient;
dbmny4minus - Negate a DBMONEY4 value.
RETCODE dbmny4minus(dbproc, src, dest)
DBPROCESS *dbproc;
DBMONEY4 *src;
DBMONEY4 *dest;
dbmny4mul - Multiply two DBMONEY4 values.
RETCODE dbmny4mul(dbproc, m1, m2, product)
DBPROCESS *dbproc;
DBMONEY4 *m1;
DBMONEY4 *m2;
DBMONEY4 *product;
dbmny4sub - Subtract one DBMONEY4 value from another.
RETCODE dbmny4sub(dbproc, m1, m2, difference)
DBPROCESS *dbproc;
DBMONEY4 *m1;
DBMONEY4 *m2;
DBMONEY4 *difference;
dbmny4zero - Initialize a DBMONEY4 variable to $0.0000.
RETCODE dbmny4zero(dbproc, mny4ptr)
DBPROCESS *dbproc;
DBMONEY4 *mny4ptr;
dbmnyadd - Add two DBMONEY values.
RETCODE dbmnyadd(dbproc, m1, m2, sum)
DBPROCESS *dbproc;
DBMONEY *m1;
DBMONEY *m2;
DBMONEY *sum;
dbmnycmp - Compare two DBMONEY values.
int dbmnycmp(dbproc, m1, m2)
DBPROCESS *dbproc;
DBMONEY *m1;
DBMONEY *m2;
dbmnycopy - Copy a DBMONEY value.
RETCODE dbmnycopy(dbproc, src, dest)
DBPROCESS *dbproc;
DBMONEY *src;
DBMONEY *dest;
dbmnydec - Decrement a DBMONEY value by one ten-thousandth of a dollar.
RETCODE dbmnydec(dbproc, mnyptr)
DBPROCESS *dbproc;
DBMONEY *mnyptr;
dbmnydivide - Divide one DBMONEY value by another.
RETCODE dbmnydivide(dbproc, m1, m2, quotient)
DBPROCESS *dbproc;
DBMONEY *m1;
DBMONEY *m2;
DBMONEY *quotient;
dbmnydown - Divide a DBMONEY value by a positive integer.
RETCODE dbmnydown(dbproc, mnyptr, divisor, remainder)
DBPROCESS *dbproc;
DBMONEY *mnyptr;
int divisor;
int *remainder;
dbmnyinc - Increment a DBMONEY value by one ten-thousandth of a dollar.
RETCODE dbmnyinc(dbproc, mnyptr)
DBPROCESS *dbproc;
DBMONEY *mnyptr;
dbmnyinit - Prepare a DBMONEY value for calls to dbmnyndigit().
RETCODE dbmnyinit(dbproc, mnyptr, trim, negative)
DBPROCESS *dbproc;
DBMONEY *mnyptr;
int trim;
DBBOOL *negative;
dbmnymaxneg - Return the maximum negative DBMONEY value supported.
RETCODE dbmnymaxneg(dbproc,dest)
DBPROCESS *dbproc;
DBMONEY *dest;
dbmnymaxpos - Returns the maximum positive DBMONEY value supported.
RETCODE dbmnymaxpos(dbproc, dest)
DBPROCESS *dbproc;
DBMONEY *dest;
dbmnyminus - Negate a DBMONEY value.
RETCODE dbmnyminus(dbproc, src, dest)
DBPROCESS *dbproc;
DBMONEY *src;
DBMONEY *dest;
dbmnymul - Multiply two DBMONEY values.
RETCODE dbmnymul(dbproc, m1, m2, product)
DBPROCESS *dbproc;
DBMONEY *m1;
DBMONEY *m2;
DBMONEY *product;
dbmnyndigit - Return the rightmost digit of a DBMONEY value as a DBCHAR.
RETCODE dbmnyndigit(dbproc, mnyptr, value, zero)
DBPROCESS *dbproc;
DBMONEY *mnyptr;
DBCHAR *value;
DBBOOL *zero;
dbmnyscale - Multiply a DBMONEY value by a positive integer and add a specified amount.
RETCODE dbmnyscale(dbproc, mnyptr, multiplier, addend)
DBPROCESS *dbproc;
DBMONEY *mnyptr;
int multiplier;
int addend;
dbmnysub - Subtract one DBMONEY value from another.
RETCODE dbmnysub(dbproc, m1, m2, difference)
DBPROCESS *dbproc;
DBMONEY *m1;
DBMONEY *m2;
DBMONEY *difference;
dbmnyzero - Initialize a DBMONEY value to $0.0000.
RETCODE dbmnyzero(dbproc, mnyptr)
DBPROCESS *dbproc;
DBMONEY *mnyptr;
dbmonthname - Determine the name of a specified month in a specified language.
char *dbmonthname(dbproc, language, monthnum,
shortform)
DBPROCESS *dbproc;
char *language;
int monthnum;
DBBOOL shortform;
DBMORECMDS - Indicate whether there are more commands to be processed.
RETCODE DBMORECMDS(dbproc)
DBPROCESS *dbproc;
dbmoretext - Send part of a text or image value to the server.
RETCODE dbmoretext(dbproc, size, text)
DBPROCESS *dbproc;
DBINT size;
BYTE *text;
dbmsghandle - Install a user function to handle server messages.
int (*dbmsghandle(handler))()
int (*handler)();
dbname - Return the name of the current database.
char *dbname(dbproc)
DBPROCESS *dbproc;
dbnextrow - Read the next result row.
STATUS dbnextrow(dbproc)
DBPROCESS *dbproc;
dbnextrow_a (VMS only) - Read the next result row.
STATUS dbnextrow_a(dbproc , final_result, ast_proc,
ast_param)
DBPROCESS *dbproc;
RETCODE *final_result;
void (*ast_proc)();
BYTE *ast_param;
dbnpcreate - Create a notification procedure.
RETCODE dbnpcreate(dbproc)
DBPROCESS *dbproc;
dbnpdefine - Define a notification procedure.
RETCODE dbnpdefine(dbproc, procedure_name, namelen)
DBPROCESS *dbproc;
DBCHAR *procedure_name;
DBSMALLINT namelen;
dbnullbind - Associate an indicator variable with a regular result row column.
RETCODE dbnullbind(dbproc, column, indicator)
DBPROCESS *dbproc;
int column;
DBINT *indicator;
dbnumalts - Return the number of columns in a compute row.
int dbnumalts(dbproc, computeid)
DBPROCESS *dbproc;
int computeid;
dbnumcols - Determine the number of regular columns for the current set of results.
int dbnumcols(dbproc)
DBPROCESS *dbproc;
dbnumcompute - Return the number of COMPUTE clauses in the current set of results.
int dbnumcompute(dbproc)
DBPROCESS *dbproc;
DBNUMORDERS - Return the number of columns specified in a Transact-SQL SELECT statement''s ORDER BY clause.
int DBNUMORDERS(dbproc)
DBPROCESS *dbproc;
dbnumrets - Determine the number of return parameter values generated by a stored procedure.
int dbnumrets(dbproc)
DBPROCESS *dbproc;
dbopen - Create and initialize a DBPROCESS structure.
DBPROCESS *dbopen(login, server)
LOGINREC *login;
char *server;
dbopen_a (VMS only) - Create and initialize a DBPROCESS structure.
RETCODE dbopen_a(login, server, dbproc, final_result,
ast_proc, ast_param)
LOGINREC *login;
char *server;
DBPROCESS *dbproc;
RETCODE *final_result;
void (*ast_proc)();
BYTE *ast_param;
dbordercol - Return the id of a column appearing in the most recently executed query''s ORDER BY clause.
int dbordercol(dbproc, order)
DBPROCESS *dbproc;
int order;
dbpoll - Check if a server response has arrived for a DBPROCESS.
RETCODE dbpoll(dbproc, milliseconds, ready_dbproc,
return_reason)
DBPROCESS *dbproc;
long milliseconds;
DBPROCESS **ready_dbproc;
int *return_reason;
dbpoll_a (VMS only) - Check if a server response has arrived for a DBPROCESS.
RETCODE dbpoll(dbproc, milliseconds, ready_dbproc,
return_reason, final_result, ast_proc, ast_param)
DBPROCESS *dbproc;
long milliseconds;
DBPROCESS **ready_dbproc;
int *return_reason;
RETCODE *final_result;
void (*ast_proc)();
BYTE *ast_param;
dbprhead - Print the column headings for rows returned from the server.
void dbprhead(dbproc)
DBPROCESS *dbproc;
dbprrow - Print all the rows returned from the server.
RETCODE dbprrow(dbproc)
DBPROCESS *dbproc;
dbprtype - Convert a token value to a readable string.
char *dbprtype(token)
int token;
dbqual - Return a pointer to a WHERE clause suitable for use in updating the current row in a browsable table.
char *dbqual(dbproc, tabnum, tabname)
DBPROCESS *dbproc;
int tabnum;
char *tabname;
DBRBUF (UNIX and AOS/VS only) - Determine whether the DB-Library network buffer contains any unread bytes.
DBBOOL DBRBUF(dbproc)
DBPROCESS *dbproc;
dbreadpage - Read a page of binary data from the server.
DBINT dbreadpage(dbproc, dbname, pageno, buf)
DBPROCESS *dbproc;
char *dbname;
DBINT pageno;
BYTE buf[];
dbreadtext - Read part of a text or image value from the server.
STATUS dbreadtext(dbproc, buf, bufsize)
DBPROCESS *dbproc;
void *buf;
DBINT bufsize;
dbrecftos - Record all SQL sent from the application to the server.
void dbrecftos(filename)
char *filename;
dbrecvpassthru - Receive a TDS packet from a server.
RETCODE dbrecvpassthru(dbproc, recv_bufp)
DBPROCESS *dbproc;
DBVOIDPTR *recv_bufp;
dbregdrop - Drop a registered procedure.
RETCODE dbregdrop(dbproc, procedure_name, namelen)
DBPROCESS *dbproc;
DBCHAR *procedure_name;
DBSMALLINT namelen;
dbregexec - Execute a registered procedure.
RETCODE dbregexec(dbproc, options)
DBPROCESS *dbproc;
DBUSMALLINT options;
dbreghandle - Install a handler routine for a registered procedure notification.
RETCODE dbreghandle(dbproc, procedure_name, namelen,
handler)
DBPROCESS *dbproc;
DBCHAR *procedure_name;
DBSMALLINT namelen;
INTFUNCPTR handler;
dbreginit - Initiate execution of a registered procedure.
RETCODE dbreginit(dbproc, procedure_name, namelen)
DBPROCESS *dbproc;
DBCHAR *procedure_name;
DBSMALLINT namelen;
dbreglist - Return a list of registered procedures currently defined in Open Server.
RETCODE dbreglist(dbproc)
DBPROCESS *dbproc;
dbregnowatch - Cancel a request to be notified when a registered procedure executes.
RETCODE dbregnowatch(dbproc, procedure_name,
namelen)
DBPROCESS *dbproc;
DBCHAR *procedure_name;
DBSMALLINT namelen;
dbregparam - Define or describe a registered procedure parameter.
RETCODE dbregparam(dbproc,param_name, type, datalen,
data)
DBPROCESS *dbproc;
char *param_name;
int type;
DBINT datalen;
BYTE *data;
dbregwatch - Request to be notified when a registered procedure executes.
RETCODE dbregwatch(dbproc, procedure_name,namelen,
options)
DBPROCESS *dbproc;
DBCHAR *procedure_name;
DBSMALLINT namelen;
DBUSMALLINT options;
dbregwatchlist - Return a list of registered procedures that a DBPROCESS is watching for.
RETCODE dbregwatchlist(dbproc)
DBPROCESS *dbproc;
dbresults - Set up the results of the next query.
RETCODE dbresults(dbproc)
DBPROCESS *dbproc;
dbresults_a (VMS only) - Set up the results of the next query.
RETCODE dbresults_a(dbproc, final_result, ast_proc,
ast_param)
DBPROCESS *dbproc;
RETCODE *final_result;
void (*ast_proc)();
BYTE *ast_param;
dbretdata - Return a pointer to a return parameter value generated by a stored procedure.
BYTE *dbretdata(dbproc, retnum)
DBPROCESS *dbproc;
int retnum;
dbretlen - Determine the length of a return parameter value generated by a stored procedure.
DBINT dbretlen(dbproc, retnum)
DBPROCESS *dbproc;
int retnum;
dbretname - Determine the name of the stored procedure parameter associated with a particular return parameter value.
char *dbretname(dbproc, retnum)
DBPROCESS *dbproc;
int retnum;
dbretstatus - Determine the stored procedure status number returned by the current command or remote procedure call.
DBINT dbretstatus(dbproc)
DBPROCESS *dbproc;
dbrettype - Determine the datatype of a return parameter value generated by a stored procedure.
int dbrettype(dbproc, retnum)
DBPROCESS *dbproc;
int retnum;
DBROWS - Indicate whether the current command actually returned rows.
RETCODE DBROWS(dbproc)
DBPROCESS *dbproc;
DBROWTYPE - Return the type of the current row.
STATUS DBROWTYPE(dbproc)
DBPROCESS *dbproc;
dbrpcinit - Initialize a remote procedure call.
RETCODE dbrpcinit(dbproc, rpcname, options)
DBPROCESS *dbproc;
char *rpcname;
DBSMALLINT options;
dbrpcparam - Add a parameter to a remote procedure call.
RETCODE dbrpcparam(dbproc, paramname, status, type,
maxlen, datalen, value)
DBPROCESS *dbproc;
char *paramname;
BYTE status;
int type;
DBINT maxlen;
DBINT datalen;
BYTE *value;
dbrpcsend - Signal the end of a remote procedure call.
RETCODE dbrpcsend(dbproc)
DBPROCESS *dbproc;
dbrpwclr - Clear all remote passwords from the LOGINREC structure.
void dbrpwclr(loginrec)
LOGINREC *loginrec;
dbrpwset - Add a remote password to the LOGINREC structure.
RETCODE dbrpwset(loginrec, srvname, password, pwlen)
LOGINREC *loginrec;
char *srvname;
char *password;
int pwlen;
dbsafestr - Double the quotes in a character string.
RETCODE dbsafestr(dbproc, src, srclen, dest,
destlen, quotetype)
DBPROCESS *dbproc;
char *src;
DBINT srclen;
char *dest;
DBINT destlen;
int quotetype;
dbsendpassthru - Send a TDS packet to a server.
RETCODE dbsendpassthru(dbproc, send_bufp)
DBPROCESS *dbproc;
DBVOIDPTR send_bufp;
dbservcharset - Get the name of the server character set.
char *dbservcharset(dbproc)
DBPROCESS *dbproc;
dbsetavail - Mark a DBPROCESS as being available for general use.
void dbsetavail(dbproc)
DBPROCESS *dbproc;
dbsetbusy - Call a user-supplied function when DB-Library is reading from the server.
void dbsetbusy(dbproc, busyfunc)
DBPROCESS *dbproc;
int (*(*busyfunc)())();
dbsetidle - Call a user-supplied function when DB-Library is finished reading from the server.
void dbsetidle(dbproc, idlefunc)
DBPROCESS *dbproc;
void (*idlefunc)();
dbsetifile - Specify the name and location of the SYBASE interfaces file.
void dbsetifile(filename)
char *filename;
dbsetinterrupt - Call user-supplied functions to handle interrupts while waiting on a read from the server.
void dbsetinterrupt(dbproc, chkintr, hndlintr)
DBPROCESS *dbproc;
int (*chkintr)();
int (*hndlintr)();
DBSETLAPP - Set the application name in the LOGINREC structure.
RETCODE DBSETLAPP(loginrec, application)
LOGINREC *loginrec;
char *application;
DBSETLCHARSET - Set the character set in the LOGINREC structure.
RETCODE DBSETLCHARSET(loginrec, char_set)
LOGINREC *loginrec;
DBCHAR *char_set;
DBSETLHOST - Set the host name in the LOGINREC structure.
RETCODE DBSETLHOST(loginrec, hostname)
LOGINREC *loginrec;
char *hostname;
DBSETLNATLANG - Set the national language name in the LOGINREC structure.
RETCODE DBSETLNATLANG(loginrec, language)
LOGINREC *loginrec;
char *language;
dbsetloginfo - Transfer TDS login information from a DBLOGINFO structure to a LOGINREC structure.
RETCODE dbsetloginfo(loginrec, loginfo)
LOGINREC *login;
DBLOGINFO *loginfo;
dbsetlogintime - Set the number of seconds that DB-Library waits for a server response to a request for a DBPROCESS connection.
RETCODE dbsetlogintime(seconds)
int seconds;
DBSETLPACKET - Set the TDS packet size in an application''s LOGINREC structure.
RETCODE DBSETLPACKET(login, packet_size)
LOGINREC *login;
short packet_size;
DBSETLPWD - Set the user server password in the LOGINREC structure.
RETCODE DBSETLPWD(loginrec, password)
LOGINREC *loginrec;
char *password;
DBSETLUSER - Set the username in the LOGINREC structure.
RETCODE DBSETLUSER(loginrec, username)
LOGINREC *loginrec;
char *username;
dbsetmaxprocs - Set the maximum number of simultaneously open DBPROCESSes.
RETCODE dbsetmaxprocs(maxprocs)
int maxprocs;
dbsetnotifs (VMS only) - Enable or disable registered procedure notifications.
RETCODE dbsetnotifs(notif_state)
DBBOOL notif_state;
dbsetnull - Define substitution values to be used when binding null values.
RETCODE dbsetnull(dbproc, bindtype, bindlen, bindval)
DBPROCESS *dbproc;
int bindtype;
int bindlen;
BYTE *bindval;
dbsetopt - Set a server or DB-Library option.
RETCODE dbsetopt(dbproc, option, char_param, int_param)
DBPROCESS *dbproc;
int option;
char *char_param;
int int_param;
dbsetrow - Set a buffered row to current.
STATUS dbsetrow(dbproc, row)
DBPROCESS *dbproc;
DBINT row;
dbsettime - Set the number of seconds that DB-Library will wait for a server response to a SQL command.
RETCODE dbsettime(seconds)
int seconds;
dbsetuserdata - Use a DBPROCESS structure to save a pointer to user- allocated data.
void dbsetuserdata(dbproc, ptr)
DBPROCESS *dbproc;
BYTE *ptr;
dbspid - Get the server process id for the specified DBPROCESS.
int dbspid(dbproc)
DBPROCESS *dbproc;
dbspr1row - Place one row of server query results into a buffer.
RETCODE dbspr1row(dbproc, buffer, buf_len)
DBPROCESS *dbproc;
char *buffer;
DBINT buf_len;
dbspr1rowlen - Determine how large a buffer to allocate to hold the results returned by dbsprhead(), dbsprline(), and dbspr1row().
DBINT dbspr1rowlen(dbproc)
DBPROCESS *dbproc;
dbsprhead - Place the server query results header into a buffer.
RETCODE dbsprhead(dbproc, buffer, buf_len)
DBPROCESS *dbproc;
char *buffer;
DBINT buf_len;
dbsprline - Choose the character with which to underline the column names produced by dbsprhead().
RETCODE dbsprline(dbproc, buffer, buf_len, linechar)
DBPROCESS *dbproc;
char *buffer;
DBINT buf_len;
DBCHAR linechar;
dbsqlexec - Send a command batch to the server.
RETCODE dbsqlexec(dbproc)
DBPROCESS *dbproc;
dbsqlexec_a (VMS only) - Send a command batch to the server and verify its correctness asynchronously.
RETCODE dbsqlexec_a(dbproc, final_result, ast_proc,
ast_param)
DBPROCESS *dbproc;
RETCODE *final_result;
void (*ast_proc)();
BYTE *ast_param;
dbsqlok - Wait for results from the server and verify the correctness of the instructions the server is responding to.
RETCODE dbsqlok(dbproc)
DBPROCESS *dbproc;
dbsqlok_a (VMS only) - Wait for results from the server and verify the correctness of the instructions asynchronously.
RETCODE dbsqlok_a(dbproc, final_result, ast_proc,
ast_param)
DBPROCESS *dbproc;
RETCODE *final_result;
void (*ast_proc)();
BYTE *ast_param;
dbsqlsend - Send a command batch to the server and do not wait for a response.
RETCODE dbsqlsend(dbproc)
DBPROCESS *dbproc;
dbstrbuild - Build a printable string from text containing placeholders for variables.
int dbstrbuild(dbproc, charbuf, bufsize,
text [, formats [, arg] ... ])
DBPROCESS *dbproc;
char *charbuf;
int bufsize;
char *text;
char *formats;
??? args???;
dbstrcmp - Compare two character strings using a specified sort order.
int dbstrcmp(dbproc, str1, len1, str2, len2, sortorder)
DBPROCESS *dbproc;
char *str1;
int len1;
char *str2;
int len2;
DBSORTORDER *sortorder;
dbstrcpy - Copy a portion of the command buffer.
RETCODE dbstrcpy(dbproc, start, numbytes, dest)
DBPROCESS *dbproc;
int start;
int numbytes;
char *dest;
dbstrlen - Return the length, in characters, of the command buffer.
int dbstrlen(dbproc)
DBPROCESS *dbproc;
dbstrsort - Determine which of two character strings should appear first in a sorted list.
int dbstrsort(dbproc, str1, len1, str2, len2, sortorder)
DBPROCESS *dbproc;
char *str1;
int len1;
char *str2;
int len2;
DBSORTORDER *sortorder;
dbtabbrowse - Determine whether the specified table is updatable via the DB-Library browse-mode facilities.
DBBOOL dbtabbrowse(dbproc, tabnum)
DBPROCESS *dbproc;
int tabnum;
dbtabcount - Return the number of tables involved in the current SELECT query.
int dbtabcount(dbproc)
DBPROCESS *dbproc;
dbtabname - Return the name of a table based on its number.
char *dbtabname(dbproc, tabnum)
DBPROCESS *dbproc;
int tabnum;
dbtabsource - Return the name and number of the table from which a particular result column was derived.
char *dbtabsource(dbproc, colnum, tabnum)
DBPROCESS *dbproc;
int colnum;
int *tabnum;
DBTDS - Determine which version of TDS (the Tabular Data Stream protocol) is being used.
int DBTDS(dbproc)
DBPROCESS *dbproc;
dbtsnewlen - Return the length of the new value of the timestamp column after a browse-mode update.
int dbtsnewlen(dbproc)
DBPROCESS *dbproc;
dbtsnewval - Return the new value of the timestamp column after a browse- mode update.
DBBINARY *dbtsnewval(dbproc)
DBPROCESS *dbproc;
dbtsput - Put the new value of the timestamp column into the given table''s current row in the DBPROCESS.
RETCODE dbtsput(dbproc, newts, newtslen, tabnum,
tabname)
DBPROCESS *dbproc;
DBBINARY *newts;
int newtslen;
int tabnum;
char *tabname;
dbtxptr - Return the value of the text pointer for a column in the current row.
DBBINARY *dbtxptr(dbproc, column)
DBPROCESS *dbproc;
int column;
dbtxtimestamp - Return the value of the text timestamp for a column in the current row.
DBBINARY *dbtxtimestamp(dbproc, column)
DBPROCESS *dbproc;
int column;
dbtxtsnewval - Return the new value of a text timestamp after a call to dbwritetext().
DBBINARY *dbtxtsnewval(dbproc)
DBPROCESS *dbproc;
dbtxtsput - Put the new value of a text timestamp into the specified column of the current row in the DBPROCESS.
RETCODE dbtxtsput(dbproc, newtxts, colnum)
DBPROCESS *dbproc;
DBBINARY *newtxts;
int colnum;
dbuse - Use a particular database.
RETCODE dbuse(dbproc, dbname)
DBPROCESS *dbproc;
char *dbname;
dbvarylen - Determine whether the specified regular result column''s data can vary in length.
DBBOOL dbvarylen(dbproc, column)
DBPROCESS *dbproc;
int column;
dbversion - Determine which version of DB-Library is in use.
char *dbversion()
dbwillconvert - Determine whether a specific datatype conversion is available within DB-Library.
DBBOOL dbwillconvert(srctype, desttype)
int srctype;
int desttype;
dbwritepage - Write a page of binary data to the server.
RETCODE dbwritepage(dbproc, dbname, pageno, size, buf)
DBPROCESS *dbproc;
char *dbname;
DBINT pageno;
DBINT size;
BYTE buf[];
dbwritetext - Send a text or image value to the server.
RETCODE dbwritetext(dbproc, objname, textptr, textptrlen,
timestamp, log, size, text)
DBPROCESS *dbproc;
char *objname;
DBBINARY *textptr;
DBTINYINT textptrlen;
DBBINARY *timestamp;
DBBOOL log;
DBINT size;
BYTE *text;
dbxlate - Translate a character string from one character set to another.
int dbxlate(dbproc, src, srclen, dest, destlen, xlt,
srcbytes_used, srcend, status)
DBPROCESS dbproc;
char *src;
int srclen;
char *dest;
int destlen;
DBXLATE *xlt;
int *srcbytes_used;
DBBOOL srcend;
e
errors - The complete collection of DB-Library errors and error severities.
#include <sybfront.h>
#include <sybdb.h>
#include <syberror.h>
o
open_commit - Establish a connection with the commit service.
DBPROCESS *open_commit(login, servername)
LOGINREC *login;
char *servername;
options - The complete list of DB-Library options.
#include <sybfront.h>
#include <sybdb.h>
s
scan_xact - Print commit service record for distributed transactions.
RETCODE scan_xact(connect, commid)
DBPROCESS *connect;
DBINT commid;
start_xact - Start a distributed transaction using the commit service.
DBINT start_xact(connect, application_name, xact_name,
site_count)
DBPROCESS *connect;
char *application_name;
char *xact_name;
int site_count;
Transact_SQL
a
abs - Returns the absolute value of a given expression.
abs (numeric_expr)
acos - Returns the angle (in radians) whose cosine is the specified floating point value.
acos (float_expr)
alter database - Increases the amount of space allocated to a database.
alter database database_name
[on {default | database_device } [= size]
[, database_device [= size]]...]
[for load]
alter table - Adds new columns to an existing table.
alter table [[database.]owner.]table_name
add column_name datatype null
[, column_name datatype null]...
ascii - Returns the ASCII code value of the leftmost character of a character experession.
ascii (char_expr)
asin - Returns the angle (in radians) whose sine is the specified floating point value.
asin (float_expr)
atan - Returns the angle (in radians) whose tangent is the specified floating point value.
atan (float_expr)
atn2 - Returns the angle (in radians) whose tangent is (float_expr1/float_expr2).
atn2 (float_expr1, float_expr2)
avg - Returns the average of the (distinct) values in the numeric column.
avg ([all | distinct] expression)
b
begin transaction - Used to mark the starting point of a user-defined transaction.
begin transaction [transaction_name]
begin...end - Encloses a series of SQL statements so that control-of-flow language, such as if-else, can affect the performance of the whole group.
begin
statement block
end
break - Causes an exit from a while loop. break is often activated by an if test.
while logical_expression
statement
break
statement
continue
c
ceiling - Returns the smallest integer greater than or equal to the specified value.
ceiling (numeric_expr)
char - Converts a single-byte integer value to a character value.
char (integer_expr)
char_length - Returns the integer value representing the number of character representations in the character expression after trailing blanks have been stripped.
char_length (char_expr)
charindex - Returns the integer value representing the starting position, in characters, of the first character expression in the second.
charindex (expression1, expression2)
checkpoint - Forces all "dirty" pages (pages that have been updated since they were last written) to be written to the database device.
checkpoint
col_length - Returns the defined length of column (use datalength to see the actual data size.)
col_length ("obj_name", "col_name")
col_name - Returns the column name.
col_name (obj_id, col_id)
Comments - Used to attach comments to SQL statements, statement blocks, and system procedures.
/* text of comment */
commit transaction - Used to mark the ending point of a user-defined transaction.
commit transaction [transaction_name]
compute clause - Generates summary values in a select statement with row aggregates (sum, avg, min, max, and count).
Start of select statement
compute row_aggregate (column_name)
[, row_aggregate(column_name)]...
[by column_name [, column_name]...]
continue - Causes the while loop to restart.
while boolean_expression
statement
break
statement
continue
convert - Converts expressions of one datatype to another datatype. Also used to obtain a variety of date formats.
convert(datatype[(length)], expression [, style] )
cos - Returns the trigonometric cosine of the specified angle (in radians).
cos (float_expr)
cot - Returns the trigonometric cotangent of the specified angle (in radians).
cot (float_expr)
count - Returns the number of the (distinct) non-null values in the column. count - Returns the number of selected row.
count (*)
count ([all | distinct] expression)
create database - Creates a new database. Use create database from the master database.
create database database_name
[on {default | database_device} [= size]
[, database_device [= size]]...]
[log on database_device [= size]
[, database_device [= size]]...]
[for load]
create default - Specifies a value to insert in a column (or in all columns of a user-defined datatype) if no value is explicitly supplied at insert time.
create default [owner.]default_name
as constant_expression
create index - Creates indexes on column(s) in a table.
create[unique][clustered|nonclustered]index index_name
on [[database.]owner.]table_name (column_name
[, column_name]...)
[with {fillfactor=x, ignore_dup_key, sorted_data,
[ignore_dup_row|allow_dup_row]}]
[on segment_name]
create procedure - Creates a stored procedure that can take one or more user-supplied parameters.
create procedure [owner.]procedure_name[;number]
[[(]@parameter_name datatype [= default][output]
[,@parameter_name datatype[=default][output]]...[)]]
[with recompile]
as SQL_statements
create rule - Specifies the domain of acceptable values for a particular column or for any column of a custom datatype.
create rule [owner.]rule_name
as condition_expression
create table - Creates new tables.
create table [[database.]owner.]table_name
(column_name datatype [not null | null]
[, column_name datatype [not null | null]]...)
[on segment_name ]
create trigger - Creates a trigger, a type of stored procedure often used for enforcing integrity constraints.
create trigger [owner.]trigger_name
on [owner.]table_name
{for {insert , update , delete}
as SQL_statements
Or, using the if update clause:
create trigger [owner.]trigger_name
on [owner.]table_name
for {insert , update}
as
[if update (column_name)
[{and | or} update (column_name)]...]...
SQL_statements}
create view - Creates views which are alternative ways of looking at the data in one or more tables.
create view [owner.]view_name
[(column_name [, column_name]...)]
as select_statement
d
data_pgs - Returns the number of pages used by table (doampg) or index (ioampg).
data_pgs (obj_id, {doampg|ioampg})
datalength - Returns the length of expression in bytes. expression is usually a column name.
datalength (expression)
dateadd - Returns the date produced by adding the specified number of the specified date parts to the date.
dateadd (datepart, number, date)
datediff - Returns date2 - date1, measured in the specified date part.
datediff (datepart, date1, date2)
datename - Returns the specified part (such as the month "June") of a datetime value as a character string.
datename (datepart, date)
datepart - Returns the specified part of a datetime value as an integer.
datepart (datepart, date)
db_id - Returns the database ID number.
db_id ("database_name")
db_name - Returns the database name.
db_name (database_id)
dbcc - Database Consistency Checker (dbcc) checks the logical and physical consistency of a database.
dbcc
{checktable (table_name) |
checkdb [(database_name)] |
checkalloc [(database_name)] |
tablealloc (table_name | table_id,
full | optimized | fast , {fix | nofix } |
indexalloc (table_name | table_id, index_id
full | optimized | fast , {fix | nofix }) |
checkcatalog [(database_name)] |
dbrepair (database_name, dropdb) |
reindex (table_name | table_id) |
fix_text (table_name | table_id )}
declare - Declares the name and type of local variables for a batch or procedure. Local variables are assigned values with a select statement.
Variable declaration:
declare @variable_name datatype
[, @variable_name datatype]...
Variable assignment:
select @variable = {expression | select_statement}
[, @variable = {expression | select_statement} ...]
[from table_list]
[where search_conditions]
[group by group_by_list]
[having search_conditions]
[order by order_by_list]
[compute function_list [by by_list]]
degrees - Returns the converts radians to degrees.
degrees (numeric_expr)
delete - Removes rows from a table. or
delete [from] [[database.]owner.]{table_name|view_name}
[where search_conditions]
delete [[database.]owner.]{table_name | view_name}
[from [[database.]owner.]{table_name | view_name}
[, [[database.]owner.]{table_name | view_name}]...]
[where search_conditions]
difference - Returns the integer representing the difference between two soundex values.
difference (char_expr1, char_expr2)
disk init - Makes a physical device or file usable by SQL Server.
disk init
name = "device_name" ,
physname = "physicalname" ,
vdevno = virtual_device_number ,
size = number_of_blocks
[, vstart = virtual_address ,
cntrltype = controller_number ]
[,contiguous] (VMS only)
disk mirror - Creates a software mirror of a user database device, the master database device, or a database device used for user database transaction logs.
disk mirror
name = "device_name" ,
mirror = "physicalname"
[ ,writes = { serial | noserial }]
[ ,contiguous ] (VMS only)
disk refit - Used after disk reinit as part of the procedure to restore a damaged master database, or if databases have been created or had space allocated since the last database or transaction log dump.
disk refit
disk reinit - Used as part of the procedure to restore a damaged master database, or if devices have been added since the last database or transaction log dump.
disk reinit
name = "device_name",
physname = "physicalname" ,
vdevno = virtual_device_number ,
size = number_of_blocks
[, vstart = virtual_address ,
cntrltype = controller_number]
disk remirror - Restarts disk mirroring.
disk remirror
name = "device_name"
disk unmirror - Suspends or stops disk mirroring.
disk unmirror
name = "device_name"
[ ,side = { primary | secondary }]
[ ,mode = { retain | remove }]
drop database - Used to remove one or more databases from SQL Server.
drop database database_name [, database_name]...
drop default - Removes a user-defined default.
drop default [owner.]default_name
[, [owner.]default_name]...
drop index - Removes an index from the database.
drop index table_name.index_name
[, table_name.index_name]...
drop procedure - Drops user-defined stored procedures.
drop procedure [owner.]procedure_name
[, [owner.]procedure_name] ...
drop rule [owner.]rule_name [, [owner.]rule_name]...
drop table - Removes a table definition and all of its data, indexes, triggers, and permission specifications from the database.
drop table [[database.]owner.]table_name
[, [[database.]owner.]table_name ]...
drop trigger - Removes a trigger.
drop trigger [owner.]trigger_name
[, [owner.]trigger_name]...
drop view - Removes views from the database.
drop view [owner.]view_name [, owner.]view_name]...
dump database - Makes a backup copy of the database and the transaction log in a form that can be read in with load database.
dump database database_name
to dump_device
dump transaction - Removes the inactive part of the transaction log and makes a backup copy of it in a form that can be read in with load transaction.
dump transaction database_name
[to dump_device]
[with truncate_only
| with no_log
| with no_truncate ]
e
execute - Runs a system procedure or a user-defined stored procedure.
[execute] [@return_status = ]
[[[server.]database.]owner.]procedure_name[;number]
[[@parameter_name =] value |
[@parameter_name =] @variable [output]
[,[@parameter_name =] value |
[@parameter_name =] @variable [output]...]]
[with recompile]
exp - Returns the exponential value of the specified value.
exp (float_expr)
f
floor - Returns the largest integer less than or equal to specified value.
floor (numeric_expr)
g
getdate - Returns the current system date and time.
getdate ( )
goto Label - Causes an unconditional branching to a user-defined label.
label:
goto label
grant - Assigns permissions to users.
Object permissions:
grant {all | permission_list}
on { table_name [(column_list)]
| view_nam e[(column_list)]
| stored_procedure_name}
to {public | name_list}
Command permissions:
grant {all | command_list}
to {public | name_list}
group by and having clauses - Used in select statements to divide a table into groups.
Start of select statement
group by [all] aggregate_free_expression
[, aggregate_free_expression]...
[having search_conditions]
End of select statement
h
host_id - Returns the host process ID of the client process (not the Server process).
host_id ( )
host_name - Returns the current host computer name of the client process (not the Server process.)
host_name ( )
i
if...else - Imposes conditions on the execution of a SQL statement.
if logical_expression
statement
[else
[if logical_expression]
statement]
index_col - Returns the name of the indexed column.
index_col ("obj_name", index_id, key_#)
insert - Adds new rows to a table or view.
insert [into] [database.[owner.]]{table_name|view_name}
[(column_list)]
{values (expression [, expression]...)
|select_statement }
isnull - Substitutes the specified value in expression2 when expression1 evaluatees to NULL.
isnull (expression, value)
k
kill - Kills a process.
kill spid
l
load database - Loads a backup copy of a user database and its transaction log that was created with dump database.
load database database_name
from dump_device
load transaction - Loads a backup copy of the transaction log.
load transaction database_name
from dump_device
log - Returns the natural logarithm of the specified value.
log (float_expr)
log10 - Returns the base 10 logarithm of the specified value.
log10 (float_expr)
lower - Converts the expression to lower case.
lower (char_expr)
ltrim - Removes leading blanks from the character expression.
ltrim (char_expr)
m
max - Returns the highest value in the expression.
max (expression)
min - Returns the lowest value in the expression.
min (expression)
o
object_id - Returns the object ID.
object_id ("db_obj_name")
object_name - Returns the object name.
object_name (db_obj_id))
order by clause - Returns query results in the specified column(s) in sorted order.
[Start of select statement ]
[order by {[table_name.| view_name.]column_name
| select_list_number | expression} [asc | desc]
[,{[table_name.| view_name.] column_name
select_list_number|expression} [asc |desc]]...]
[End of select statement]
p
patindex - Returns an integer representing the starting position of the first occurrence of pattern in the specified character expression, zero if pattern is not found.
patindex ("%pattern%", char_expr
[, using {bytes | chars | characters] } )
pi - Returns the returns the constant value of 3.1415926535897936.
pi ()
power - Returns the value of numerc_expr to the power of power.
power (numeric_expr, power)
prepare transaction - Used by DB-Library in a two-phase commit application to see if a server is prepared to commit a transaction.
prepare transaction
print - Prints a user-defined message on the user''s screen.
print
{format_string | @local_variable | @@global_variable}
[, arg_list]
r
radians - Returns the converts degrees to radians.
radians (numeric_expr)
raiserror - Prints a user-defined error message on the user''s screen and sets a system flag to record that an error condition has occurred.
raiserror error_number
{format_string | @local_variable} [, arg_list]
rand - Returns the returns a random float number between 0 and 1.
rand ([integer_expr])
readtext - Reads text and image values, starting from a specified offset and reading a specified number of bytes or characters.
readtext [[database.]owner.]table_name.column_name
text_pointer offset size [holdlock]
[using {bytes | chars | characters}]
reconfigure - Sets configuration variables that control various aspects of SQL Server''s memory allocation, performance, and options.
reconfigure [with override]
replicate - Returns a string with the same datatype as char_expr, containing the same expression repeated the specified number of times or as many times as will fit into a 255 byte space, whichever is less.
replicate (char_expr, integer_expr)
reserved_pgs - Returns the number of pages allocated to table or index.
reserved_pgs (obj_id,{doampg|ioampg})
return - Exits from a query or procedure unconditionally, optionally providing a return status. Statements following return are not executed.
return [integer_expression]
reverse - Returns the reverse of char_expr; if char_expr is "abcd", it returns "dcba".
reverse (char_expr)
revoke - Revokes permissions from users.
revoke {all | permission_list}
on { table_name [(column_list)]
| view_name [(column_list)]
| stored_procedure_name}
from {public | name_list}
revoke {all | command_list}
from {public | name_list}
right - Returns the part of the character expression starting the specified number of characters from the right.
right (char_expr, integer_expr)
rollback transaction - Used to roll a user-defined transaction back to the last savepoint inside a transaction or to the beginning of a transaction.
rollback transaction
[transaction_name | savepoint_name]
round - Returns the rounds off a numeric expression to the precision specified in integer_expr.
round (numeric_expr, integer_expr)
Row Aggregates - Used in a select statement with the compute clause, the row aggregates (sum, avg, min, max, and count) generate summary values, which appear as additional rows in the query results.
Start of select statement
compute row_aggregate(column_name)
[, row_aggregate(column_name)]...
[by column_name [, column_name]...]
rowcnt - Returns the number of rows in a table (estimate)
rowcnt (doampg)
rtrim - Removes trailing blanks.
rtrim (char_expr)
s
save transaction - Used to set a savepoint within a transaction.
save transaction savepoint_name
select - Retrieves rows from the database.
select [all | distinct] select_list
[into [[database.]owner.]table_name]
[from [[database.]owner.]{table_name |view_name}
[holdlock]
[,[[database.]owner.]{table_name |view_name}
[holdlock]]... ]
[where search_conditions]
[group by [all] aggregate_free_expression
[, aggregate_free_expression]... ]
[having search_conditions]
[order by
{[[[database.]owner.]{table_name.|view_name.}]
column_name | select_list_number | expression}
[asc | desc]
[,{[[[database.]owner.]{table_name|view_name.}]
column_name | select_list_number | expression}
[asc | desc]]...]
[compute row_aggregate(column_name)
[, row_aggregate(column_name)]...
[by column_name [, column_name]...]]
[for browse]
set - Sets SQL Server query-processing options for the duration of the user''s work session.
set { arithabort, arithignore, nocount, noexec,
parseonly, procid, showplan }
{on | off}
set offsets { select, from, order, compute, table,
procedure, statement, param, execute } {on | off}
set statistics { io, time} {on|off}
set { datefirst number, dateformat format,
language language }
set rowcount number
set textsize number
set char_convert { off |
on [with {error | no_error}] |
charset [with {error | no_error}] }
setuser - Used by a Database Owner to impersonate another user.
setuser ["user_name"]
shutdown - Brings the system to a halt. This command can only be issued by the System Administrator.
shutdown [with nowait]
sign - Returns the returns (+1), zero (0), or negative (-1).
sign (numeric_expr)
sin - Returns the trigonometric sine of the specified angle (measured in radians).
sin (float_expr)
soundex - Returns a four-character soundex code for character strings that are composed of a contiguous sequence of valid single- or double-byte roman letters.
soundex (char_expr)
space - Returns a string with the indicated number of single-byte spaces.
space (integer_expr)
sqrt - Returns the square root of the specified value.
sqrt (float_expr)
str - Returns an character representation of the floating point number.
str (float_expr [, length [, decimal]]
stuff - Deletes "length" characters from char_expr1 at "start", then inserts char_expr2 into char_expr1 at "start".
stuff (char_expr1, start, length, char_expr2)
substring - Returns part of a character or binary string.
substring (expression, start, length)
sum - Returns the total of the (distinct) values in the numeric column.
sum ([all | distinct] expression)
suser_id - Returns the server user''s ID number from syslogins.
suser_id (["server_user_name"])
suser_name - Returns the server user''s name.
suser_name ([server_user_id])
t
tan - Returns the trigonometric tangent of the specified angle (measured in radians).
tan (float_expr)
textptr - Returns the text pointer value, a 16-byte binary value.
textptr (text_columname)
textvalid - Checks if a given text pointer is valid.
textvalid ("table_name..col_name", textpointer)
truncate table - Removes all rows in a table as quickly as possible.
truncate table [[database.]owner.]table_name
tsequal (timestamp, timestamp2)
u
union operator - Combines the results of two or more queries into a single result set consisting of all the distinct rows belonging to A or B, or both. result set consisting of all the distinct rows belonging to A or B, or both.
select select_list [into clause]
[from clause] [where clause]
[group by clause] [having clause]
[union [all]
select select_list
[from clause] [where clause]
[group by clause] [having clause] ]...
[order by clause]
[compute clause]
update - Changes data in existing rows, either by adding data or modifying existing data.
update [[database.]owner.]{table_name | view_name}
set [[[database.]owner.]{table_name.|view_name.}]
column_name1 =
{expression1|NULL|(select_statement)}
[, column_name2 =
{expression2|NULL|(select_statement)}]...
[from [[database.]owner.]{table_name | view_name}
[, [[database.]owner.]{table_name|view_name}]...
[where search_conditions]
update statistics - Updates information about the distribution of key values in specified indexes.
update statistics table_name [index_name]
upper - Converts to upper case.
upper (char_expr)
use - Specifies the database with which you want to work.
use database_name
used_pgs - Returns the total number of pages used by a table and its clustered index or index.
used_pgs (obj_id, doampg, ioampg)
user_id - Returns the user''s ID number.
user_id (["user_name"])
user_name - Returns the user''s name, based on the user''s ID in the current database..
user_name ([user_id])
v
valid_name - Returns 0 if string is not a valid identifier (illegal characters or string is more than 30 bytes long), a nonzero number if string is a valid identifer.
valid_name ("string")
w
waitfor - Specifies a specific time, a time interval, or an event for the execution of a statement block, stored procedure, or transaction.
waitfor { delay time | time time | errorexit
| processexit | mirrorexit }
where clause - Sets the search conditions in a select, insert, update, or delete statement.
where [not] expression comparison_operator expression
where [not] expression [not] like "match_string"
where [not] expression is [not] null
where [not]
expression [not] between expression and expression
where [not]
expression [not] in ({value_list | subquery})
where [not] exists (subquery)
where [not]
expression comparison_operator {any|all} (subquery)
where [not] column_name join_operator column_name
where [not] boolean_expression
where [not] expression {and | or} [not] expression
while - Sets a condition for the repeated execution of a statement or statement block.
while logical_expression
statement
writetext - Permits non-logged, interactive updating of an existing text or image columns.
writetext [[database.]owner.]table_name.column_name
text_pointer [with log] data
UNIX Utility
b
bcp - Copies a database table to or from an operating system file in a user- specified format.
bcp [[database_name.]owner.]table_name {in | out}
datafile
[-m maxerrors] [-f formatfile] [-e errfile]
[-F firstrow] [-L lastrow] [-b batchsize]
[-T text_or_image_size]
[-n] [-c]
[-t field_terminator] [-r row_terminator]
[-U username] [-P password] [-I interfaces_file]
[-S server]
[-a display_charset][-q datafile_charset]
[-J client_charset][-z language] [-v]
buildmaster - Builds the master database.
buildmaster [-d physicalname] [-c cntrltype]
[-s size] [-r] [-m]
c
console - Operator''s utility for dumping to or loading from a tape drive.
console [-v]
d
dataserver - The executable form of the SQL Server program.
dataserver -ddevicename [-eerrorlogfile] [-m]
[-rmastermirror]
defncopy - Copies definitions for specified views, rules, defaults, triggers, or procedures from a database to an operating system file or from an operating system file to a database.
defncopy [-U username} [-P password] [-S server] [-v]
[-I interfaces_file] [-a display_charset]
[-J client_charset] [-z language]
{in filename dbname | out filename dbname
[owner.]objectname [[owner.]objectname]...}
i
isql - Interactive SQL parser to SQL Server.
isql [-e] [-p] [-n] [-v]
[-c cmdend] [-h headers] [-w columnwidth]
[-s colseparator]
[-t timeout] [-m errorlevel]
[-U username] [-P password]
[-S server] [-I interfaces_file]
[-i inputfilename] [-o outputfilename]
[-a display_charset] [-z language]
[-J client_charset]
To terminate a command: go
To clear the query buffer: reset
To call the editor: vi
To execute an operating system command: !! command
To exit from isql: quit or exit
l
langinstall - Install one new language on SQL Server. Can be run by the System Administrator only.
langinstall [-S server] [-I interfaces_file]
[-P password] [-R release_number]
[ -v ] language
s
showserver - Shows SQL Servers that are currently running on the local machine.
showserver
startserver - Start SQL Server.
startserver [-f runserverfile] [-m]
VMS Utility
b
bcp - Copies a database table to or from a host file in a user-specified format.
bcp [[database_name.]owner.]table_name {in | out}
data_file
[/max_errors = integer]
[/format_file = file_name]
[/errorfile = file_name]
[/first_row = integer]
[/last_row = integer]
[/batch_size = integer]
[/TextSize = text or image size]
[/native_default]
[/character_default]
[/column_terminator = string]
[/row_terminator = string]
[/input = input_file]
[/output = output_file]
[/username = user_name]
[/password = user_password]
[/interfaces = interface_file]
[/server_name = server_name]
[/dispcharset = display_charset]
[/filecharset = datafile_charset]
[/language = language]
[/version]
buildmaster - Builds the master database. buildmaster - Builds the master database.
buildmaster [/disk = physicalname]
[/cntrltype = integer]
[/size = integer]
[/reconfigure]
[/master]
[/contiguous]
c
console - Operator''s utility for dumping to or loading from a tape drive.
console [/version] [/dispcharset = display_charset]
d
dataserver - The executable form of the SQL Server program.
dataserver [/device = (devicename[, mastermirror])]
[/errorfile = errorlogfile]
[/masterrecover]
[/section_file = filename]
defncopy - Copies definitions for specified views, rules, defaults, triggers, or procedures from a database to a host file or from a host file to a database.
defncopy [/username = username]
[/password = password]
[/server_name = server_name]
[/interfaces = interfaces_file]
[/dispcharset = display_charset]
[/language = language]
[/version]
{in filename dbname | out filename dbname
[owner.]objectname [[owner.]objectname]...}
i
isql - Interactive SQL parser to SQL Server.
isql [/echo] [
/statistics]
[/noprompt]
[/version]
[/terminator = string]
[/rowsinpage = integer]
[/timeout = integer]
[/colwidth = integer]
[/separator = character]
[/errorlevel = integer]
[/username = user_name]
[/password = user_password]
[/interfaces = file_name]
[/server_name = server_name]
[/input = input_file]
[/output = output_file]
[/dispcharset = display_charset]
[/language = language]
or
isql /version [/output = output_file]
To terminate a command: go
To clear the query buffer: reset
To call the editor: edit
To exit from isql: quit or exit
l
langinstall - Install one new language on SQL Server. Can be run by the System Administrator only.
langinstall [/server_name = server_name]
[/password = password]
[/interfaces = interfaces_file]
[/release = release_number]
[/version]
/language
s
showserver - Shows SQL Servers that are currently running on the local machine.
showserver [/server = server_name]
[/all]
[/process]
[/continuous]
startserver - Starts SQL Server or a Companion Server as a detached process.
startserver [/server = server_name]
[/masterserver = node1]
[/runserver = filename]
[/companions = (node2{, node3...})]
[/wait | /nowait]
[/quota = quota_filename]
[/priority = integer]
[/multiple]
[/masterrecover]
[/error = errorlog_file]
[/openserver = openserver_name]
[/privileges = (priv1 {, priv2...})]
stopserver - Stops execution of the currently running SQL Server. Can be run by the System Administrator only.
stopserver [/server = server_name]
[/masterserver]
[/password]
[/companions [= (node2{, node3...}]]
[/nowait]
[/abort]
Thanks goes to Kevin Beyer (
beyer@cs.wisc.edu) for developing this page.