User Tools

Site Tools


sybase_sql_snippets

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
sybase_sql_snippets.txt · Last modified: 2017/01/01 20:05 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki