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)
 Information_Schema views issue for 2k

Author  Topic 

Rita Bhatnagar
Posting Yak Master

172 Posts

Posted - 2002-04-08 : 12:29:52
I have this query and it's working fine right now.
Do you think i can get in trouble by using
INFORMATION_SCHEMA.Columns. We have set of tables
where we have same kind of structure. But the length
of second column is not same for all the tables.

CREATE PROCEDURE qryFieldSize
@TableName varchar(30),
@Length int output
AS
Set @length=0
set @Length= (select Character_maximum_Length from
INFORMATION_SCHEMA.Columns Where Ordinal_Position=2
and Table_Name=@TableName)
select @length


robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-04-08 : 12:38:35
The INFORMATION_SCHEMA views are standardized as part of the ANSI SQL definitions. They are the most reliable way to get information on columns, tables, and such because of that. They are informational only, you cannot INSERT, UPDATE, or DELETE from an INFORMATION_SCHEMA view.

The system tables that SQL Server uses are different from other products, and these system tables change from version to version, so that a query might not work in a future version (you're not querying system tables directly anyway, so this won't be an issue for you)

Go to Top of Page
   

- Advertisement -