all groups > sql server programming > april 2005 >
You're in the

sql server programming

group:

Metadata Detail


RE: Metadata Detail Alejandro Mesa
4/5/2005 11:27:03 AM
sql server programming:
[quoted text, click to view]

Use functionS COLUMNPROPERTY, IDENT_SEED, IDENT_INCR, and IDENT_CURRENT. For
"Description" use system function fn_listextendedproperty and for "Formula
value" check system table syscomments.

Example:

use northwind
go

create table dbo.t (
colA int not null identity,
colB uniqueidentifier ROWGUIDCOL not null default(newid()),
colC as power(2, colA),
colD as colA % 10
)
go

select
ordinal_position,
column_name,
case when columnproperty(object_id(quotename(table_schema) + '.' +
quotename(table_name)), column_name, 'IsIdentity') = 1 then 'Yes' else 'No'
end as [IsIdentity],
case when columnproperty(object_id(quotename(table_schema) + '.' +
quotename(table_name)), column_name, 'IsIdentity') = 1 then
ltrim(ident_seed(table_name)) else '' end as [ident_seed],
case when columnproperty(object_id(quotename(table_schema) + '.' +
quotename(table_name)), column_name, 'IsIdentity') = 1 then
ltrim(ident_incr(table_name)) else '' end as [ident_incr],
case when columnproperty(object_id(quotename(table_schema) + '.' +
quotename(table_name)), column_name, 'IsIdentity') = 1 then
ltrim(ident_current(table_name)) else '' end as [ident_current],
case when columnproperty(object_id(quotename(table_schema) + '.' +
quotename(table_name)), column_name, 'IsRowGuidCol') = 1 then 'Yes' else 'No'
end as [IsRowGuidCol],
coalesce(sc.[text], '') as [Formula]
from
information_schema.columns as c
left join
syscomments as sc
on object_id(quotename(table_schema) + '.' + quotename(table_name)) =
sc.[id] and sc.number = c.ordinal_position

where
table_name = 't'
order by
ordinal_position
go

drop table t
go


AMB


[quoted text, click to view]
Re: Metadata Detail Alejandro Mesa
4/5/2005 12:45:05 PM
See if this helps:

http://support.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.programming&mid=9a5ce1f9-3929-4cf7-b0b1-bf887160c5df&sloc=en-us&sloc=en-us


AMB

[quoted text, click to view]
Metadata Detail AM
4/5/2005 11:23:10 PM
Hi all

I want to get some metadata information for my tables

Some column properties I can get using System tabes and Information Schema

but I can not get some information as below

I want to get information of column properties Identity Seed, Identity
Increment, Is Rowguid , Formula value, Description for my any column which
this property applicable.


Any help will be highly appreciated

Thanks

Re: Metadata Detail AM
4/6/2005 12:02:32 AM
Thanks
It helps me a lot

[quoted text, click to view]

Re: Metadata Detail Steve Beach
4/6/2005 10:01:11 AM
Also check out following link for " Schema: How do I show the description
property of a column? ":

http://www.aspfaq.com/show.asp?id=2244

[quoted text, click to view]

AddThis Social Bookmark Button