常用sql存储过程集锦

--1.给表中字段添加描述信息
 CREATE   table T2 (id int , name char (20))
 GO
 EXEC   sp_addextendedproperty 'MS_Description', 'Employee ID', 'user', dbo, 'table', T2, 'column', id
 EXEC   sp_updateextendedproperty 'MS_Description', 'this is a test', 'user', dbo, 'table', T2, 'column', id

--2.修改数据库名称
  EXEC sp_renamedb 'old_db_name', 'new_db_name'

--3.修改数据表名称和字段名称
  EXEC sp_rename 'old_table_name', 'new_table_name'--修改数据表名称
  EXEC sp_rename 'table_name.[old_column_name]', 'new_column_name', 'COLUMN'--修改字段名称

posted @ 2013-02-20 17:06  yellowshorts  阅读(186)  评论(0)    收藏  举报