PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > comp.db.ms-sqlserver > Design Table; Columns/Description get with SP???
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Design Table; Columns/Description get with SP???

Réponse
 
LinkBack Outils de la discussion
Vieux 18/09/2007, 17h29   #1 (permalink)
vesta
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Design Table; Columns/Description get with SP???

Hi,

I'm using stored procedures to create an online data dictionary for
all of our dbs and I thought it would be very cool if there was a way
that I could somehow pull the columns description entered in the table
design view (lower pane) of EM. I have poked around, but have not
found a way. It is my suspcion that this may be impossible. Does any
smart person out there know?

Also want to pull pks and fks and other constraints, which I think I
can figure out how to do, but if anyone has any pointers, that would
also be appreciated.

Many Thanks,

Georgia

  Réponse avec citation
Vieux 18/09/2007, 17h51   #2 (permalink)
Roy Harvey (MVP)
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Design Table; Columns/Description get with SP???

That description is stored as an extended property. Look at the
documentation of function fn_listextendedproperty for instructions on
how to retrieve this.

Roy Harvey
Beacon Falls, CT

On Tue, 18 Sep 2007 09:29:46 -0700, vesta <vesta0424@gmail.com> wrote:

>Hi,
>
>I'm using stored procedures to create an online data dictionary for
>all of our dbs and I thought it would be very cool if there was a way
>that I could somehow pull the columns description entered in the table
>design view (lower pane) of EM. I have poked around, but have not
>found a way. It is my suspcion that this may be impossible. Does any
>smart person out there know?
>
>Also want to pull pks and fks and other constraints, which I think I
>can figure out how to do, but if anyone has any pointers, that would
>also be appreciated.
>
>Many Thanks,
>
>Georgia

  Réponse avec citation
Vieux 18/09/2007, 20h32   #3 (permalink)
vesta
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Design Table; Columns/Description get with SP???

It looks to me like you create your extended properties with this
function. Are there any default functions to get the information that
has been manually entered in the description field?

Georgia


On Sep 18, 12:51 pm, "Roy Harvey (MVP)" <roy_har...@snet.net> wrote:
> That description is stored as an extended property. Look at the
> documentation of function fn_listextendedproperty for instructions on
> how to retrieve this.
>
> Roy Harvey
> Beacon Falls, CT
>
>
>
> On Tue, 18 Sep 2007 09:29:46 -0700, vesta <vesta0...@gmail.com> wrote:
> >Hi,

>
> >I'm using stored procedures to create an online data dictionary for
> >all of our dbs and I thought it would be very cool if there was a way
> >that I could somehow pull the columns description entered in the table
> >design view (lower pane) of EM. I have poked around, but have not
> >found a way. It is my suspcion that this may be impossible. Does any
> >smart person out there know?

>
> >Also want to pull pks and fks and other constraints, which I think I
> >can figure out how to do, but if anyone has any pointers, that would
> >also be appreciated.

>
> >Many Thanks,

>
> >Georgia- Hide quoted text -

>
> - Show quoted text -



  Réponse avec citation
Vieux 18/09/2007, 22h25   #4 (permalink)
Erland Sommarskog
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Design Table; Columns/Description get with SP???

vesta (vesta0424@gmail.com) writes:
> It looks to me like you create your extended properties with this
> function. Are there any default functions to get the information that
> has been manually entered in the description field?


No, functions don't create anything, they can only retrieve data. To
add an extended property from T-SQL, you use sp_addextendedproperty.

I cannot really give any examples of using either, because I have not
used extended properties myself very much. Or rather not at all.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
  Réponse avec citation
Vieux 18/09/2007, 22h40   #5 (permalink)
Roy Harvey (MVP)
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Design Table; Columns/Description get with SP???

I used Management Studio from SQL Server 2005 to generate a script of
creating a table with one column, and a description on that column.
Note the use of sp_addextendedproperty under the covers to save the
description.

/* To prevent any potential data loss issues, you should review this
script in detail before running it outside the context of the database
designer.*/
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
GO
CREATE TABLE dbo.Table_1
(
A int NULL
) ON [PRIMARY]
GO
DECLARE @v sql_variant
SET @v = N'Testing Testing Testing'
EXECUTE sp_addextendedproperty N'MS_Description', @v, N'SCHEMA',
N'dbo', N'TABLE', N'Table_1', N'COLUMN', N'A'
GO
COMMIT

And now we retrieve the description:

SELECT *
FROM ::fn_listextendedproperty (NULL, 'user', 'dbo', 'table',
'Table_1', 'column', default)

objtype objname name value
---------- ---------- ------------------ -------------------------
COLUMN A MS_Description Testing Testing Testing

(1 row(s) affected)

Roy Harvey
Beacon Falls, CT

On Tue, 18 Sep 2007 12:32:28 -0700, vesta <vesta0424@gmail.com> wrote:

>It looks to me like you create your extended properties with this
>function. Are there any default functions to get the information that
>has been manually entered in the description field?
>
>Georgia
>
>
>On Sep 18, 12:51 pm, "Roy Harvey (MVP)" <roy_har...@snet.net> wrote:
>> That description is stored as an extended property. Look at the
>> documentation of function fn_listextendedproperty for instructions on
>> how to retrieve this.
>>
>> Roy Harvey
>> Beacon Falls, CT
>>
>>
>>
>> On Tue, 18 Sep 2007 09:29:46 -0700, vesta <vesta0...@gmail.com> wrote:
>> >Hi,

>>
>> >I'm using stored procedures to create an online data dictionary for
>> >all of our dbs and I thought it would be very cool if there was a way
>> >that I could somehow pull the columns description entered in the table
>> >design view (lower pane) of EM. I have poked around, but have not
>> >found a way. It is my suspcion that this may be impossible. Does any
>> >smart person out there know?

>>
>> >Also want to pull pks and fks and other constraints, which I think I
>> >can figure out how to do, but if anyone has any pointers, that would
>> >also be appreciated.

>>
>> >Many Thanks,

>>
>> >Georgia- Hide quoted text -

>>
>> - Show quoted text -

>

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 10h46.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11874 seconds with 13 queries