columns description how to use it on QA

  • how do you use columns description on QA? I want to type it in some description for my columns. I see this option on EM. Need to know how to do it on QA

  • Description is an extended property and not part of the SQL Language so in truth you cannot use it directly in QA.

    -- This is how you add.

    DECLARE @v-2 sql_variant

    SET @v-2 = N'Description Goes Here'

    EXECUTE sp_addextendedproperty N'MS_Description', @v-2, N'user', N'dbo', N'table', N'Table Name Goes Here', N'column', N'Column Name Here'

    -- This is how you read all back.

    SELECT   *

    FROM   ::fn_listextendedproperty (N'MS_Description', N'user', N'dbo', N'table', N'Table Name Goes Here', N'column', default)

  • Column Descriptions are extended properties. If you make the change in EM, then script it out, you see the code that you need to run in QA.  It's a good idea to check the box in EM to always prompt for scripting changes, then you can keep a record of what you did, especially if you make changes in one DB, and later want to apply those changes to another DB. Click the "Save Change Script" icon when you modify a table, then choose "Automatically generate change script .."

     

    For example:

    DECLARE @v-2 sql_variant

    SET @v-2 = N'This is a column description'

    EXECUTE sp_addextendedproperty N'MS_Description', @v-2, N'user', N'dbo', N'table', N'Table_Name', N'column', N'Column_Name'

    EDIT:  Antares, you beat me by a millisecond !!

  • thanks

  • Too funny.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply