0

I need to add comments to fields in SQL Server, and I know I can do it through designer.

I have many tables where there are the same fields:

  • InsertDate
  • ModifyDate
  • AddUserId
  • ModifyUserId

and so on.

I'd like to write a script that will find all tables and will add comments to these fields. Eventually, I can pass tables names to the scripts.

How can I achieve this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
tylkonachwile
  • 2,025
  • 4
  • 16
  • 28
  • 2
    Although I've linked to the duplicate, why wouldn't you *source control* your schema instead and use that for information about *when* and *who* changed things. Especially, scalar `ModifyXxx` properties tend to be pointless because a history of User 1 Creates table, User 2 makes a horrific modification, User 3 makes a benign change ends up pointing at Users 1 and 3 and doesn't give you any clue that you need to hunt down User 2. – Damien_The_Unbeliever Nov 21 '18 at 07:57
  • And no one really needs a comment for columns like InsertDate. Don't create pointless work or useless reading. – SMor Nov 21 '18 at 14:25

0 Answers0