How to get the information required to code generate stored procedures for sql 2000

The following is the SQL required to get what is needed from a SQL Server 2000 so that a read-only DAL can be generated from a view.

SELECT obj.name AS VIEW_NAME,
       col.name AS COLUMN_NAME,
       types.name AS COL_DATATYPE,
       col.length
FROM syscolumns col
JOIN sysobjects obj ON col.id = obj.id AND obj.xtype = ‘V’
JOIN systypes types ON col.xtype = types.xtype
WHERE obj.name NOT LIKE ‘SYS%’
ORDER BY obj.name, col.colorder

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s