====== Sybase SQL Snippets ======
===== Get Info from SysObjects =====
SELECT *
FROM sysobjects
WHERE 1 = 1
--AND sysobjects.type = 'U' -- user table
--AND sysobjects.type = 'V' -- view
--AND sysobjects.type = 'L' -- log
--AND sysobjects.type = 'P' -- procedure
--AND sysobjects.type = 'R' -- rule
--AND sysobjects.type = 'D' -- default
--AND sysobjects.type = 'TR' -- trigger
--AND sysobjects.type = 'RI' -- referential constraint
ORDER BY sysobjects.name
===== Show Columns In A Table =====
SELECT syscolumns.name
, *
FROM syscolumns
JOIN sysobjects ON syscolumns.id = sysobjects.id
WHERE sysobjects.name = 'TABLE_NAME'
ORDER BY syscolumns.name
===== Search All Column Names =====
SELECT sysobjects.name
, syscolumns.name
, *
FROM syscolumns
JOIN sysobjects ON syscolumns.id = sysobjects.id
WHERE syscolumns.name like '%directive_id%'
ORDER BY sysobjects.name ASC
, syscolumns.name ASC
{{tag>reference sybase sql code_snippet}}