Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 What's wrong w/ this GetSchemaListing VIEW?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-10-08 : 09:30:53
Paul writes "The following produces an error 4511, saying that it could
not create the view because no column name was specified
for column n. The value of 'n' will vary depending upon the
number of fields+1 specified in the SELECT.

CREATE VIEW GetSchemaListing AS
SELECT
TOP 100 PERCENT
substring(TABLE_CATALOG, 1, 12) AS CATALOG,
substring(TABLE_SCHEMA, 1, 10) AS OWNER,
substring(TABLE_NAME, 1, 40) AS TABLE_NAME,
substring(COLUMN_NAME, 1, 36) AS COLUMN_NAME,
substring(DATA_TYPE, 1, 10) AS DATA_TYPE,
CHARACTER_MAXIMUM_LENGTH AS CHAR_LENGTH
FROM INFORMATION_SCHEMA.COLUMNS
ORDER BY TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME"
   

- Advertisement -