Get Columns of Particular Type in Database (Sybase)

The procedure below allows you to get a column list of a particular type in a database currently used:

CREATE PROCEDURE dbo.GetColumnOfType
@type longsysname
AS
SELECT c.name, t.name, * FROM syscolumns c
LEFT OUTER JOIN systypes t
ON t.type = c.type
WHERE t.name LIKE @type

You can use it like this:

EXEC dbo.GetColumnOfType '%money%'
Advertisements
This entry was posted in Sybase, T-SQL. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s