Thursday, February 16, 2012

Column description

Does anybody know where stored column description in sql2K database is?
Is it possible to script table with this information.
Thanks in advanceVicko
SELECT s2.id, s1.name,
( SELECT s3.value
FROM sysproperties s3
WHERE s3.id = s1.id
AND s3.smallid = s1.colid ) AS "col desc"
FROM syscolumns s1
INNER JOIN sysobjects s2
ON s1.id = s2.id
WHERE s2.name = @.tablename
"Vicko" <avicentic@.gmail.com> wrote in message
news:1155730450.323233.199170@.i42g2000cwa.googlegroups.com...
> Does anybody know where stored column description in sql2K database is?
> Is it possible to script table with this information.
> Thanks in advance
>|||Great,
What about script?
Anyway, I could insert or update sysproperties table.
Uri Dimant wrote:[vbcol=seagreen]
> Vicko
> SELECT s2.id, s1.name,
> ( SELECT s3.value
> FROM sysproperties s3
> WHERE s3.id = s1.id
> AND s3.smallid = s1.colid ) AS "col desc"
> FROM syscolumns s1
> INNER JOIN sysobjects s2
> ON s1.id = s2.id
> WHERE s2.name = @.tablename
>
> "Vicko" <avicentic@.gmail.com> wrote in message
> news:1155730450.323233.199170@.i42g2000cwa.googlegroups.com...|||Vicko
Here's an example script:
create table dbo.customer (
customer_id integer not null identity (1, 1)
, trade_name varchar (0255) not null
)
go
alter table dbo.customer add
constraint pk_customer primary key nonclustered (customer_id)
go
/* column description meta info */
execute sp_addextendedproperty N'boolean_property_01', '1', N'user', N'dbo',
N'table', N'customer', N'column', N'trade_name'
execute sp_addextendedproperty N'column_description', 'Customer trading
name', N'user', N'dbo', N'table', N'customer', N'column', N'trade_name'
go
select * from :: fn_listextendedproperty (NULL, 'user', 'dbo', 'table',
'customer', 'column', default)
go
drop table dbo.customer
go
"Vicko" <avicentic@.gmail.com> wrote in message
news:1155732443.407871.64680@.i42g2000cwa.googlegroups.com...
> Great,
> What about script?
> Anyway, I could insert or update sysproperties table.
>
> Uri Dimant wrote:
>|||Vicko wrote:

> Anyway, I could insert or update sysproperties table.
For reference, directly modifying the system tables is a big no-no.

No comments:

Post a Comment