sqlserver更新表脚本
--增加项目字段,门店信息,所在省份,所在市,所在区县,提供服务
ALTER TABLE [dbo].[school_base_info]
ADD [store_information] varchar(32) NULL
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description',
'SCHEMA', N'dbo',
'TABLE', N'school_base_info',
'COLUMN', N'store_information')) > 0)
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'门店信息'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'school_base_info'
, @level2type = 'COLUMN', @level2name = N'store_information'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'门店信息'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'school_base_info'
, @level2type = 'COLUMN', @level2name = N'store_information'
GO
ALTER TABLE [dbo].[school_base_info]
ADD [store_in_province] varchar(32) NULL
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description',
'SCHEMA', N'dbo',
'TABLE', N'school_base_info',
'COLUMN', N'store_in_province')) > 0)
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'所在省份'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'school_base_info'
, @level2type = 'COLUMN', @level2name = N'store_in_province'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'所在省份'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'school_base_info'
, @level2type = 'COLUMN', @level2name = N'store_in_province'
GO
ALTER TABLE [dbo].[school_base_info]
ADD [store_in_city] varchar(32) NULL
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description',
'SCHEMA', N'dbo',
'TABLE', N'school_base_info',
'COLUMN', N'store_in_city')) > 0)
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'所在市'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'school_base_info'
, @level2type = 'COLUMN', @level2name = N'store_in_city'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'所在市'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'school_base_info'
, @level2type = 'COLUMN', @level2name = N'store_in_city'
GO
ALTER TABLE [dbo].[school_base_info]
ADD [store_in_area] varchar(32) NULL
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description',
'SCHEMA', N'dbo',
'TABLE', N'school_base_info',
'COLUMN', N'store_in_area')) > 0)
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'所在区县'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'school_base_info'
, @level2type = 'COLUMN', @level2name = N'store_in_area'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'所在区县'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'school_base_info'
, @level2type = 'COLUMN', @level2name = N'store_in_area'
GO
ALTER TABLE [dbo].[school_base_info]
ADD [store_support] varchar(512) NULL
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description',
'SCHEMA', N'dbo',
'TABLE', N'school_base_info',
'COLUMN', N'store_support')) > 0)
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'提供服务'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'school_base_info'
, @level2type = 'COLUMN', @level2name = N'store_support'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'提供服务'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'school_base_info'
, @level2type = 'COLUMN', @level2name = N'store_support'
GO
--增加会员信息表字段,邀请人ID,是否已下单,会员类型
ALTER TABLE [dbo].[sys_common_user]
ADD [invitor_id] varchar(32) NULL
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description',
'SCHEMA', N'dbo',
'TABLE', N'sys_common_user',
'COLUMN', N'invitor_id')) > 0)
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'邀请人ID'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'sys_common_user'
, @level2type = 'COLUMN', @level2name = N'invitor_id'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'邀请人ID'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'sys_common_user'
, @level2type = 'COLUMN', @level2name = N'invitor_id'
GO
ALTER TABLE [dbo].[sys_common_user]
ADD [is_order] varchar(2) NULL
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description',
'SCHEMA', N'dbo',
'TABLE', N'sys_common_user',
'COLUMN', N'is_order')) > 0)
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'是否已下单'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'sys_common_user'
, @level2type = 'COLUMN', @level2name = N'is_order'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'是否已下单'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'sys_common_user'
, @level2type = 'COLUMN', @level2name = N'is_order'
GO
ALTER TABLE [dbo].[sys_common_user]
ADD [user_type] varchar(32) NULL
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description',
'SCHEMA', N'dbo',
'TABLE', N'sys_common_user',
'COLUMN', N'user_type')) > 0)
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'会员类型'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'sys_common_user'
, @level2type = 'COLUMN', @level2name = N'user_type'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'会员类型'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'sys_common_user'
, @level2type = 'COLUMN', @level2name = N'user_type'
GO
//增加商品表字段,商品低价
ALTER TABLE [dbo].[food_base_info]
ADD [floor] decimal(8,2) NULL
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description',
'SCHEMA', N'dbo',
'TABLE', N'food_base_info',
'COLUMN', N'floor')) > 0)
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'商品底价'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'food_base_info'
, @level2type = 'COLUMN', @level2name = N'floor'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'商品底价'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'food_base_info'
, @level2type = 'COLUMN', @level2name = N'floor'
GO
ALTER TABLE [dbo].[food_base_info]
ADD [food_kind] varchar(2) NULL
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description',
'SCHEMA', N'dbo',
'TABLE', N'food_base_info',
'COLUMN', N'kind')) > 0)
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'商品种类'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'food_base_info'
, @level2type = 'COLUMN', @level2name = N'kind'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'商品种类'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'food_base_info'
, @level2type = 'COLUMN', @level2name = N'kind'
GO
//增加订单表字段,修改次数,订单完成时间
ALTER TABLE [dbo].[order_main_info]
ADD [mod_time] varchar(2) NULL
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description',
'SCHEMA', N'dbo',
'TABLE', N'order_main_info',
'COLUMN', N'mod_time')) > 0)
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'修改次数'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'order_main_info'
, @level2type = 'COLUMN', @level2name = N'mod_time'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'修改次数'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'order_main_info'
, @level2type = 'COLUMN', @level2name = N'mod_time'
GO
ALTER TABLE [dbo].[order_main_info]
ADD [complete_time] datetime NULL
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description',
'SCHEMA', N'dbo',
'TABLE', N'order_main_info',
'COLUMN', N'complete_time')) > 0)
EXEC sp_updateextendedproperty @name = N'MS_Description', @value = N'订单完成时间'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'order_main_info'
, @level2type = 'COLUMN', @level2name = N'complete_time'
ELSE
EXEC sp_addextendedproperty @name = N'MS_Description', @value = N'订单完成时间'
, @level0type = 'SCHEMA', @level0name = N'dbo'
, @level1type = 'TABLE', @level1name = N'order_main_info'
, @level2type = 'COLUMN', @level2name = N'complete_time'
GO
sqlserver更新表脚本的更多相关文章
- (喷血分享)利用.NET生成数据库表的创建脚本,类似SqlServer编写表的CREATE语句
(喷血分享)利用.NET生成数据库表的创建脚本,类似SqlServer编写表的CREATE语句 在我们RDIFramework.NET代码生成器中,有这样一个应用,就是通过数据库表自动生成表的CREA ...
- 利用.NET生成数据库表的创建脚本,类似SqlServer编写表的CREATE语句
利用.NET生成数据库表的创建脚本,类似SqlServer编写表的CREATE语句 (喷血分享)利用.NET生成数据库表的创建脚本,类似SqlServer编写表的CREATE语句 在我们RDIFram ...
- sqlserver 将一个表中的某些字段更新到另一个表中(转载)
来源:https://blog.csdn.net/qq_23888451/article/details/86615555 https://blog.csdn.net/cyxinda/article/ ...
- SQLSERVER数据库表各种同步技术
1 --SQLSERVER数据库表各种同步技术 减少SQLServer中每次的同步数据量 2 3 --说到数据库,我就不由地想到同步数据,如何尽可能地减少每次的同步数据量,以此来提高同步效率,降低对网 ...
- sqlserver 2008表分区操作
表分区操作步骤 1.设计表进行分区的方案,水平分区.垂直分区 a.水平切割将减少表的行数,这样可以将历史数据归档,减少表大小,提高访问速度. b.垂直切割将分为主表和从表方式,将主要的列字段存放在主表 ...
- sqlserver 删除表中 指定字符串
源表T "单据编号" "航班计划日期" "航班号" "起飞航站代码&q ...
- SqlServer判断表中某列是否包含中文,英文,纯数字
原文:SqlServer判断表中某列是否包含中文,英文,纯数字 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog ...
- Oracle、SQLServer 删除表中的重复数据,只保留一条记录
原文地址: https://blog.csdn.net/yangwenxue_admin/article/details/51742426 https://www.cnblogs.com/spring ...
- python 生产数据表脚本
# -*- coding: utf-8 -*-import re"""建立相关表的字段从源表创建指定的MySQL建表脚本"""# 目标表名称 ...
随机推荐
- 在表单里面检查用户名是否存javascript
function CheckUser(fn) { $.get("/Pages/Handler/CheckExistHander.ashx", { "txt_UserNo& ...
- python读取文件特定的行数
from itertools import islice f=open("pyhpd.txt") for a in islice(f,2,6): print(a)
- 1000个经常使用的Python库和演示样例代码
以下是programcreek.com通过分析大量开源码,提取出的最经常使用的python库. 1. sys (4627) 2. os (4088) 3. re (3563) 4 ...
- 算法笔记_060:蓝桥杯练习 出现次数最多的整数(Java)
目录 1 问题描述 2 解决方案 1 问题描述 问题描述 编写一个程序,读入一组整数,这组整数是按照从小到大的顺序排列的,它们的个数N也是由用户输入的,最多不会超过20.然后程序将对这个数组进行统 ...
- html 接收GET请求参数
function GetQueryString(name) { var reg = new RegExp("(^|&)"+ name +" ...
- linux下Oracle11g RAC搭建(二)
linux下Oracle11g RAC搭建(二) 一.安装前配置 网络的配置 IP占用測试 进入windows下.运行cmd,使用ping命令验证网段是否被占用. 注:用哪个网段都行,一定保证不要被其 ...
- Android so文件生成
http://blog.csdn.net/laczff21/article/details/7542236 http://blog.csdn.net/yhm2046/article/details/8 ...
- C# 重载和默认参数(那种情况下使用更好)
当你提供函数,外部因为要传入不同参数个数,重载会导致 外部if增加, 默认参数可以消除外部的if.当外部调用函数需要判断调用那个函数,根据调用次数增多 if跟着调用持续增多两种不同的调用 //重载 ...
- cpu时间 / cpu利用率计算
CPU时间即反映CPU全速工作时完成该进程所花费的时间 cpu时间计算CPU TIME = (# of CPU Clock Cycles) x Clock Period // “#” 表示消耗 ...
- 如何为Drupal缓存对象指定缓存类?
什么意思?意思是说,假如你有这样的需求,需要将cache_page缓存到数据库,其它的都缓存到memcache,这该怎么办? 看看_cache_get_object()的实现你就会知道上面的问题该怎么 ...