pandas用法大全
一、生成数据表 1、首先导入pandas库,一般都会用到numpy库,所以我们先导入备用:import numpy as npimport pandas as pd122、导入CSV或者xlsx文件:df = pd.DataFrame(pd.read_csv('name.csv',header
Python关键词(keywords)笔记
关键词表? deldel用于list列表操作,删除一个或连续几个列表元素或者列表本身。点击(此处)折叠或打开a = [-1, 3, 'aa', 85, 'bbb', 555]print adel a[0]print adel a[2:4]print a...
使用waitfor time和waitfor delay在一定时间间隔下定时执行批处理
使用waitfor time和waitfor delay[@more@][case 1]WAITFOR TIME '01:20:04'begin declare @i int = 0 while (@i < 3) begin insert into ContentType_Log(TypeID,TypeName,LastUpdateDate) select TypeID,TypeName,getdate() as LastUpdateDate from TypeTable set @i = @i + 1 WAITFOR DELAY '00:00:10' endendGO[case 2]WAITFOR TIME '01:23:34'GObegin insert into ContentType_Log(TypeID,TypeName,LastUpdateDate) select TypeID,TypeName,getdate() as LastUpdateDate from TypeTable WAITFOR DELAY '00:00:10' endGO 3
Troubleshooting: Connecting to SQL Server When System Administrators Are Locked Out
http://msdn.microsoft.com/en-us/library/dd207004%28v=sql.105%29.aspx[@more@][run as Admin]Microsoft Windows [Version 6.1.7601]Copyright (c) 2009 Microsoft Corporation. All rights reserved.C:Windowssystem32>C:Windowssystem32>net stop mssqlserverThe SQL Server (MSSQLSERVER) service is stopping.The SQL Server (MSSQLSERVER) service was stopped successfully.C:Windowssystem32>net start mssqlserver /mThe SQL Server (MSSQLSERVER) service is starting.The SQL Server (MSSQLSERVER) service was sta
Database Unit Testing
Database Unit TestingDAL(Database Access Layer) Unit Testing[@more@]1. Database Unit Testinghttp://www.databasejournal.com/features/mssql/article.php/3844791/Database-Unit-Testing.htmhttp://www.cnblogs.com/harrychinese/articles/TutorialQuickStart.htmlhttps://anydbtest.codeplex.com/releases/view/609812. DAL(Database Access Layer) Unit Testinghttp://www.codeproject.com/Articles/12334/Armadillo-Unit-Testing-of-inline-SQL-with-a-little?q=c%23+db+unit+test+framework#intro
偶发的存储过程调用性能问题的一次调优过程
某存储过程调用频繁,绝大部分调用在1秒内结束。在每30分钟内,有30到40次调用超过10秒。从业务上我们知道这个过程调用很频繁,但到是什么程度,我们还不清楚。另外,从执行计划上来看,已经最优,没有优化SQL的空间了。下面是在这种情况下的调优过程。[@more@]1. 系统检测 (1)取系统等待并且阻塞的进程 SET NOCOUNT ON SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED GO CREATE TABLE #block( [current_time] [datetime] NOT NULL, [resource_type] [nvarchar](60) NOT NULL, [requ
获取SQL Server中连接的客户端IP地址
有时候需要获取连接到SQL Server服务器上的客户端IP地址,用什么办法呢?[@more@]SELECT *FROM sys.dm_exec_connections WHERE session_id = @@SPID 这个办法不适用于SQL2005和以前版本。 如果是SQL Server2008,还可以用CONNECTIONPROPERTY方法获取: SELECT CONNECTIONPROPERTY('net_transport') AS net_transport, CONNECTIONPROPERTY('protocol_type') AS protocol_type, CONNECTIONPROPERTY('auth_scheme') AS auth_scheme, CONNECTIONPROPERTY('local_net_address') AS lo
SQL Server中常用全局变量和系统信息
在SQL Server中,全局变量是一种特殊类型的变量,服务器将维护这些变量的值。全局变量以@@前缀开头,不必进行声明,它们属于系统定义的函数。还有一些系统信息的获取方法,例如服务器上次启动时间。[@more@]全局变量名称描述@@CONNECTIONS返回 SQL Server 自上次启动以来尝试的连接数。@@CPU_BUSY返回 SQL Server 自上次启动后的工作时间。@@CURSOR_ROWS返回连接上打开的上一个游标中的当前限定行的数目,确定当其被调用时检索了游标符合条件的行数。@@DATEFIRST针对会话返回 SET DATEFIRST 的当前值,SET DATEFIRST 表示指定的每周的第一天
SQL Server中查询用户的对象权限和角色的方法
SQL Server中查询用户的对象权限和角色的方法[@more@] -- 查询用户的object权限exec sp_helprotect NULL, 'UserName' -- 查询用户拥有的roleexec sp_helpuser 'UserName' -- 查询哪些用户拥有指定的系统roleexec sp_helpsrvrolemember 'sysadmin' -- 可查询嵌套roleWITH tree_roles as(SELECT role_principal_id, member_principal_idFROM sys.database_role_membersWHERE member_principal_id = USER_ID('UserName')UNION ALLSELECT c.role_principal_id,c.member_principal_idFROM sys.database_role_members as cinner join tree_r
SQL Server 2005/2008 对With Encryption选项创建的存储过程解密
1. 创建sp__windbi$decrypt 2. 使用DAC(专用管理员连接)连接到数据库 3. 调用解密[@more@]http://www.cnblogs.com/kiant71/archive/2009/09/10/1752016.html
SQL Server 索引使用分析 - SARG(Searchable Arguments)
SARG的定义:用于限制搜索的一个操作,因为它通常是指一个特定的匹配,一个值得范围内的匹配或者两个以上条件的AND连接。形式如下:列名 操作符 <常数 或 变量> 或 <常数 或 变量> 操作符列名[@more@]很多人不知道SQL语句在SQL SERVER中是如何执行的,他们担心自己所写的SQL语句会被SQL SERVER误解。比如:select * from table1 where name=''zhangsan'' and tID > 10000和执行:select * from table1 where tID > 10000 and name=''zhangsan''一些人不知道以上两条语句的执行效率是否一样,因为如果简单的从语句先
在Eclipse中用JDBC连接Sql Server 2005总结
原帖及讨论:http://bbs.bccn.net/thread-140292-1-1.html* 最近因为开发活动需要,用上了Eclipse,并要求使用精简版的SQL数据库(即Sql server 2005)来进行开发项目 *[@more@]1.准备工作: 准备相关的软件(Eclipse除外,开源软件可以从官网下载)<1>.Microsoft SQL server 2005 Express Edition下载地址:http://download.microsoft.com/download/0/9/0/09020fab-d2c3-4a8c-b9e0-db53a7a30ae8/SQLEXPR_CHS.EXE<2>.SQL Server Management Studio下载地址:http://www.microsoft.com/downloads/details.aspx?displaylang=zh-cn&Fam
Sql server 2005中output用法解析
SQL Server 2005中的output子句,可以使你从修改语句(INSERT、UPDATE、DELETE)中将数据返回到表变量中。带结果的 DML 的有用方案包括清除和存档、消息处理应用程序以及其他方案。 [@more@]一、关于output子句 SQL Server 2005中的output子句,可以使你从修改语句(INSERT、UPDATE、DELETE)中将数据返回到表变量中。带结果的 DML 的有用方案包括清除和存档、消息处理应用程序以及其他方案。这一新的 OUTPUT 子句的语法为: OUTPUT INTO @table_variable 可以通过引用插入的表和删除的表来访问被修改的行的旧/新映像,其方式与访问触发
A Guide for SQL Server Backup Application Vendors
Summary: SQL Server 2005 provides support for Volume Shadow Copy Service (VSS) by providing a writer (the SQL writer) so that a third-party backup application can use the VSS framework to back up database files. This paper describes the SQL writer component and its role in the VSS snapshot creation and restore process for SQL Server databases. It also captures details on how to configure and use the SQL writer to work with backup applications in the VSS framework. On This Page Intr
SQL Server Transaction Log Fragmentation: a Primer
Generally, you will have no need to worry about the number of virtual log files in your transaction log. However, if you use the default settings for 'auto-grow', you can end up with such 'fragmentation' in your transaction log as to affect performance noticably. How can this be avoided? How can you tell it's a problem? What do you do about it? Greg explains.[@more@]http://www.simple-talk.com/sql/database-administration/sql-server-transaction-log-fragmentation-a-primer/
Database Testing: How to Regression Test a Relational Database
Why test an RDBMS? What should we test? When should we test? How should we test?Who should test? Introducing database testing into your organization Database testing and data inspection Best practices [@more@]http://www.agiledata.org/essays/databaseTesting.html#Tools
SQLite数据库访问编程及管理工具
工具SQLite AdministratorSQLite Database BrowserVisual studio 2005下使用SQLite数据库使用SQLite.NET访问SQLite结合Enterprise Library操作SQLiteADO.NET访问SQLite[@more@]可视化的SQLite数据库管理工具管理SQLite数据库除命令行外,网络上还有很多开源的可视化的SQLite数据库管理工具,登陆https://sourceforge.net/或者通过其他搜索引擎(GOOOGLE/BAIDU),输入【SQLite】可以找到一大片相关工具,比如,SQLite Database Browser、SQLite Administrator... 等等。试用了几个,比较而言,个人比较喜欢SQLite Administrator,该工具界面
一个小时内学习SQLite数据库
SQLite 是一个开源的嵌入式关系数据库,实现自包容、零配置、支持事务的SQL数据库引擎。 其特点是高度便携、使用方便、结构紧凑、高效、可靠。 与其他数据库管理系统不同,SQLite 的安装和运行非常简单,在大多数情况下 - 只要确保SQLite的二进制文件存在即可开始创建、连接和使用数据库。如果您正在寻找一个嵌入式数据库项目或解决方案,SQLite是绝对值得考虑。[@more@]1. 介绍SQLite 是一个开源的嵌入式关系数据库,实现自包容、零配置、支持事务的SQL数据库引擎。 其特点是高度便携、使用方便、结构紧凑、高效、可靠。 与其他数据库管理
用CLR函数把HTMLCode转换为原字符
1. HTMLCode格式2. 转换方法3. 部署方法4. 调用方法[@more@]1. HTMLCoding格式因为安全方面的原因,网页提交html特殊字符例如<, >,', "等和汉字时,常常被编码为HTMLCode格式。例如:[ ' ] - ’[ " ] - ”[ < ] - <[ > ] - >[中国] - & #20013;& #22269;C#引用System.Web.dll,调用HttpUtility.HtmlDecode转换成原文。具体:VS.net建立Database项目而不是CLR项目,否则,不能Reference System.Web.dll到项目中;创建CLR Funcation,调用 HttpUtility.HtmlDecode转换成原文
使用CLR函数压缩(Gzip)ntext类型字段
Gzip to StringString to Gzip[@more@]using System;using System.Data;using System.Data.SqlClient;using System.Data.SqlTypes;using Microsoft.SqlServer.Server;using System.IO;using System.IO.Compression;using System.Text;public partial class Gzip{ [Microsoft.SqlServer.Server.SqlFunction] public static SqlChars GzipToString(SqlBytes gBytes) { byte[] bytes = gBytes.Value; bytes = Decompress(bytes); string str = Encoding.GetEncoding(936).GetString(bytes); SqlChars s