Coding for removing servername from the views.

Coding for removing servername from the views.

--The following script is to find out the existing views of the database machine‘s display

USE Database;

SELECT

b.name,

c.referenced_server_name,

c.referenced_database_name,

c.referenced_schema_name,

a.definition,

b.create_date,

b.modify_date

FROM sys.sql_modules AS a

JOIN

sys.objects AS b

ON a.object_id = b.object_id

JOIN

sys.sql_expression_dependencies AS c

ON b.object_id = c.referencing_id

WHERE b.type = ‘V‘

AND c.referenced_server_name IS NOT NULL

--The following script is to modify the database view exists after the replacement of the processing machine

SET NOCOUNT ON;

DECLARE @definition VARCHAR(MAX)

DECLARE @ServerN VARCHAR(50)

DECLARE View_Cursor CURSOR SCROLL

FOR (

SELECT

c.referenced_server_name,

a.definition

FROM sys.sql_modules AS a

JOIN

sys.objects AS b

ON a.object_id = b.object_id

JOIN

sys.sql_expression_dependencies AS c

ON b.object_id = c.referencing_id

WHERE b.type = ‘V‘

AND c.referenced_server_name IS NOT NULL

)

OPEN View_Cursor;

FETCH NEXT FROM View_Cursor INTO @ServerN,@definition;

WHILE @@fetch_status = 0

BEGIN

SELECT @definition = REPLACE (@definition,‘CREATE VIEW‘,‘ALTER VIEW‘)

SELECT @definition = REPLACE (@definition,‘[‘[email protected]+‘]‘+‘.‘,‘‘)

--print(@definition);

exec(@definition);

FETCH NEXT FROM View_Cursor INTO @ServerN,@definition;

END

CLOSE View_Cursor;

DEALLOCATE View_Cursor;

GO

时间: 2024-08-28 18:30:58

Coding for removing servername from the views.的相关文章

VMware Coding Challenge: Removing Duplicates Entries

1 static LinkedListNode removeDuplicates(LinkedListNode list) { 2 LinkedListNode cur = list; 3 HashSet<Integer> set = new HashSet<Integer>(); 4 set.add(list.val); 5 while (cur.next != null) { 6 if (!set.contains(cur.next.val)) { 7 set.add(cur.

django xadmin 插件(3) 列表视图新增自定义按钮

效果图: 编辑按钮是默认的list_editable属性对应的插件(xadmin.plugins.editable) 放大按钮对应的是自定义插件. 自定义按钮源码: xplugin.py(保证能够直接或者间接被adminx.py引用到即可) # -*- coding:utf-8 -*- import xadmin from xadmin.views import BaseAdminPlugin, ListAdminView from xadmin.views.edit import ModelF

websocket之django简单使用

WebSocket protocol: WebSocket protocol 是HTML5一种新的协议.它是实现了浏览器与服务器全双工通信(full-duplex).HTML5定义了WebSocket协议,能更好的节省服务器资源和带宽并达到实时通讯.我们知道,传统的HTTP协议是无状态的,每次请求(request)都要由客户端(如 浏览器)主动发起,服务端进行处理后返回response结果,而服务端很难主动向客户端发送数据:这种客户端是主动方,服务端是被动方的传统Web模式 对于信息变化不频繁的

REST framework(2)

RESTful API设计 API与用户的通信协议,总是使用HTTPs协议. 域名  https://api.example.com                         尽量将API部署在专用域名(会存在跨域问题) https://example.org/api/                        API很简单 版本 URL,如:https://api.example.com/v1/ 请求头                                         

xadmin集成DjangoUeditor,以及编辑器的视频路径配置

稍微讲一下DjangoUeditor的配置,因为之前去找配置的时候东拼西凑的,所以自己写一下自己一步步配置的过程.首先我是再github上去下载下来,因为是当作第三方插件集成到xadmin中,所以不用pip安装,直接和xadmin放一个目录就ok了. 然后是在项目的设置里面进行配置,在INSTALLED_APPS中申明DjangoUeditor的存在, 这两步做完之后就找到xadmin的plugins目录,在目录下新建一个ueditor.py的文件,其中的代码如下: #!/usr/bin/env

Flask开发系列之初体验

Flask开发初探 介绍 在日常开发中,如果需要开发一个小型应用或者Web接口,一般我是极力推崇Flask的,主要是因为其简洁.扩展性高. 从这篇文章开始,我会写一个关于Flask的系列文章,通过多个实例,由浅入深,融入自己使用Flask的心得,希望能帮助更多朋友学习Flask. 在此之前,建议你了解常见理论(包括视图.模板等),阅读Flask的官方文档,了解sqlalchemy,有一定的前端基础. 开发环境:ubuntu + Python2.7X + mysql 本系列文章代码将持续更新于my

xadmin 安装

xadmin 安装 环境(一定要一样) Python 3.6.2 Django 2.0 安装 pip install django==2.0, 指定特定的版本 pip install https://codeload.github.com/sshwsfc/xadmin/zip/django2, 从官方的 github 上下载 django2 分支的包, 也可通将该包下载下来再使用 pip 安装, 但是不推荐使用 pip 安装, 建议将 xadmin 放到 libs 下 目录结构 . ├── __

linux c coding style

Linux kernel coding style This is a short document describing the preferred coding style for the linux kernel. Coding style is very personal, and I won't _force_ my views on anybody, but this is what goes for anything that I have to be able to mainta

django removing hardcoded URLs in template --- 使用变量,把url放在变量中 {% url &#39;namespace:name&#39; %}

1 urlpatterns = [ 2 url(r'^admin/', admin.site.urls), 3 url(r'^votes/', include("polls.urls", namespace="polls")), 4 ] /myproject/urls.py 1 #!/usr/bin/env python 2 # -*- coding:utf-8 -*- 3 4 ''' 5 @version: 6 @author: leo Yang 7 @licen