sql server programming:
[quoted text, click to view] > 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.
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] "AM" wrote:
> 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
>
>
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] "AM" wrote:
> Thanks
> It helps me a lot
>
> "Alejandro Mesa" <AlejandroMesa@discussions.microsoft.com> wrote in message
> news:364FC5DB-E29F-47E8-BA44-A0842193E142@microsoft.com...
> > > 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.
> >
> > 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
> >
> >
> > "AM" wrote:
> >
> > > 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
> > >
> > >
> > >
>
>
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
Thanks
It helps me a lot
[quoted text, click to view] "Alejandro Mesa" <AlejandroMesa@discussions.microsoft.com> wrote in message
news:364FC5DB-E29F-47E8-BA44-A0842193E142@microsoft.com...
> > 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.
>
> 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
>
>
> "AM" wrote:
>
> > 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
> >
> >
> >
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] "AM" <anonymous@developersdex.com> wrote in message
news:%23WseefgOFHA.1476@TK2MSFTNGP09.phx.gbl...
> 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
>
>
Don't see what you're looking for? Try a search.