Sybase SYSOBJECTS type definitions

Well, here is all the type definitions you find in sysobjects table :

D – default
F – SQLJ function
L – log
P – Transact-SQL or SQLJ procedure
PR – prepare objects (created by Dynamic SQL)
R – rule
RI – referential constraint
S – system table
TR – trigger
U – user table
V – view
XP – extended stored procedure

So, if you need the name of all stored procedures in a database for instance you can do :

select name from sysobjects where type = ‘P’

Read More

Sybase DBCC sp

sp_dbcc_alterws sp_dbcc_alterws – Changes the size of the specified workspace to a specified value, and initializes the workspace. sp_dbcc_alterws dbname, wsname, “wssize[K|M]”
sp_dbcc_configreport sp_dbcc_configreport – Generates a report that describes the configuration information used by the dbcc checkstorage operation for the specified database. sp_dbcc_configreport [dbname]
sp_dbcc_createws sp_dbcc_createws – Creates a workspace of the specified type and size on the specified segment and database. sp_dbcc_createws dbname, segname, [wsname], wstype, “wssize[K|M]”
sp_dbcc_deletedb sp_dbcc_deletedb – Deletes from dbccdb all the information related to the specified target database. sp_dbcc_deletedb [dbname]
sp_dbcc_deletehistory sp_dbcc_deletehistory – Deletes the results of dbcc checkstorage operations performed on the target database before the specified date and time. sp_dbcc_deletehistory [cutoffdate [, dbname]]
sp_dbcc_differentialreport sp_dbcc_differentialreport – Generates a report that highlights the changes I/O statistics and faults that took place between two dbcc operations. sp_dbcc_differentialreport [dbname [, objectname]], [db_op] [, “date1” [, “date2”]]
sp_dbcc_evaluatedb sp_dbcc_evaluatedb – Recomputes configuration information for the target database and compares it to the current configuration information. sp_dbcc_evaluatedb [dbname]
sp_dbcc_faultreport sp_dbcc_faultreport – Generates a report covering fault statistics for the dbcc checkstorage operations performed for the specified object in the target database on the specified date. sp_dbcc_faultreport [dbname [, objectname [, date [, “short” | “long”]]]]
sp_dbcc_fullreport sp_dbcc_fullreport – Runs sp_dbcc_summaryreport, sp_dbcc_configreport, sp_dbcc_statisticsreport, and sp_dbcc_faultreport short for database..object_name on or before the specified date. sp_dbcc_fullreport [dbname [, objectname [, date]]]
sp_dbcc_runcheck sp_dbcc_runcheck – Runs dbcc checkstorage on the specified database, and then runs sp_dbcc_summaryreport or a report you specify. sp_dbcc_runcheck dbname [, user_proc]
sp_dbcc_statisticsreport sp_dbcc_statisticsreport – Generates an allocation statistics report on the specified object in the target database. sp_dbcc_statisticsreport [dbname [, objectname [, date]]]
sp_dbcc_summaryreport sp_dbcc_summaryreport – Generates a summary report on the specified database. sp_dbcc_summaryreport [dbname [, date]]
sp_dbcc_updateconfig sp_dbcc_updateconfig – Updates the dbcc_config table in dbccdb with the configuration information of the target database. sp_dbcc_updateconfig dbname, type, “str1” [, “str2”]
Read More

sybase copy table;pt=48334

select * into auditarchive7_5 
 from sybsecurity.dbo.sysaudits
Read More

MsSql 2008 link server ODBC sybase

exec sp_addlinkedserver @server = ‘Chron1’ ,
@srvproduct = ‘Sybase’,
@provider = ‘MSDASQL’,
@datasrc = ‘Chron1’

sp_addlinkedserver @server= server

, @srvproduct= product_name]
, @provider= provider_name]
, @datasrc= data_source]
, @location= location]
, @provstr= provider_string]
, @catalog= catalog]

The following table shows the ways that a linked server can be set up for data sources accessible through OLE DB. A linked server can be set up using more than one way for a given data source; there may be more than one row for a data source type. This table also shows thesp_addlinkedserver parameter values to be used for setting up the linked server.

Remote OLE DB data source OLE DB provider product_name provider_name data_source location provider_string catalog
SQL Server Microsoft OLE DB Provider for SQL Server SQL Server (1)
SQL Server Microsoft OLE DB Provider for SQL Server SQL Server SQLOLEDB Network name of SQL Server (for default instance) Database name (optional)
SQL Server Microsoft OLE DB Provider for SQL Server SQLOLEDB Servername\instancename (for specific instance) Database name (optional)
Oracle Microsoft OLE DB Provider for Oracle Any (2) MSDAORA SQL*Net alias for Oracle database
Access/Jet Microsoft OLE DB Provider for Jet Any Microsoft.Jet.OLEDB.4.0 Full path name of Jet database file
ODBC data source Microsoft OLE DB Provider for ODBC Any MSDASQL System DSN of ODBC data source
ODBC data source Microsoft OLE DB Provider for ODBC Any MSDASQL ODBC connection string
File system Microsoft OLE DB Provider for Indexing Service Any MSIDXS Indexing Service catalog name
Microsoft Excel Spreadsheet Microsoft OLE DB Provider for Jet Any Microsoft.Jet.OLEDB.4.0 Full path name of Excel file Excel 5.0
IBM DB2 Database Microsoft OLE DB Provider for DB2 Any DB2OLEDB See Microsoft OLE DB Provider for DB2 documentation. Catalog name of DB2 database

Read More

Sybase – list current user session

select distinct
name, procid, totcpu, totio
FROM master..syslogins sl,
master..sysprocesses sp
where sl.suid=sp.suid
order by name

select * from master..syslogins
select * from master..sysprocesses

Read More