随笔分类 - sqlserver
摘要:USE masterGORECONFIGURE --先执行一次刷新,处理上次的配置GOEXEC sp_configure 'show advanced options',1 --启用xp_cmdshell的高级配置GORECONFIGURE --刷新配置GOEXEC sp_configure 'xp
阅读全文
摘要:--1、查进程select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableNamefrom sys.dm_tran_locks where resource_type='OBJECT'order by
阅读全文
摘要:--导入大文件50G文件到mysql1、修改配置innodb_flush_log_at_trx_commit=0 2、导入时的注意事项set autocommit=1;show variables like 'autocommit';set names utf8;source f://file.sq
阅读全文
摘要:SELECT t.NAME AS TableName, s.Name AS SchemaName, p.rows AS RowCounts, SUM(a.total_pages) * 8 AS TotalSpaceKB, CAST(ROUND(((SUM(a.total_pages) * 8) /
阅读全文
摘要:use ylbx_1--1、创建文件组 常用系统表sysfiles、sys.database_files、sys.filegroups--alter DATABASE ylbx_1 REMOVE filegroup fileGroup_2018_01alter DATABASE ylbx_1 add
阅读全文
摘要:EXEC sp_addlinkedserver 'LinkName','','SQLOLEDB','121.43.177.236'EXEC sp_addlinkedsrvlogin 'LinkName','false',NULL,'sa','sa' SELECT * FROM LinkName.ce
阅读全文
摘要:--reverse:字符串倒排 SUBSTRING(字段,1,len(字段)- CHARINDEX('-',REVERSE(字段)))
阅读全文
摘要:1--所有的表添加'datatsp和datatsp_int'--select * from sysobjects where xtype='U' order by name--数据库中所有的只具有一个主键表添加'datatsp和datatsp_int'declare @table_name varc...
阅读全文
摘要:select a.name,b.rows from sysobjects a,sysindexes bwhere a.id=b.id and xtype='U' AND (b.indid IN (0, 1))-- and rows>=8575order by b.rows desc
阅读全文
摘要:修改注册表:HKLM\Software\Microsoft\MicrosoftSQLServer\90\Tools\ShellSEM,把ShellSEM重命名即可如果是64位机器 在HKLM\Software\Wow6432Node\Microsoft\MicrosoftSQLServer\90\T...
阅读全文
摘要:SET STATISTICS PROFILE ON --SET STATISTICS IO ON --SET STATISTICS TIME ONdeclare @dtm datetimeSQL语句print '添加person临时表数据:'+convert(varchar(10),DATEDIFF...
阅读全文
摘要:参考:http://www.cnblogs.com/ycsfwhh/archive/2010/12/15/1906507.html1.双方启动MSDTC服务MSDTC(分布式交易协调器),协调跨多个数据库、消息队列、文件系统等资源管理器的事务。该服务的进程名为Msdtc.exe,该进程调用系统Mic...
阅读全文
摘要:看代码declare @iid intselect @iid=111select top 1 @iid=isnull(IID,0) from YYGL_PCDMX where IID=0print @iid上面的情况,如果iid=0没有记录,则@iid会取111,为了避免这个问题1、在查询前,初始化...
阅读全文
摘要:/*Title:TDE加密Author:浪客Environment:Windows Server 2008 Enterprise + SQL Server 2008 EnterpriseDescription:请在非生产环境下测试*/USE [master];GO--查看master数据库是否被加密SELECT name,is_master_key_encrypted_by_server FROM sys.databases;--创建master数据库下的主数据库密钥CREATE MASTER KEY ENCRYPTION BY PASSWORD = N'浪客!@#$%^&*(
阅读全文
摘要:--MyDB为修复的数据名USE MASTERGOSP_CONFIGURE 'ALLOW UPDATES',1 RECONFIGURE WITH OVERRIDEGOALTER DATABASE MyDB SET EMERGENCYGOsp_dboption 'MyDB', 'single user', 'true'GODBCC CHECKDB('MyDB','REPAIR_ALLOW_DATA_LOSS')GOALTER DATABASE MyDB SET ONLINEGOsp_configure
阅读全文
摘要:Hkey_local_machine\Software\Wow6432Node\Microsoft\MicrosoftSQLServer\90\Tools\ShellSEM 中的ShellSEM重命名
阅读全文
摘要:******* 导出到excelEXEC master..xp_cmdshell ''bcp SettleDB.dbo.shanghu out c:\temp1.xls -c -q -S"GNETDATA/GNETDATA" -U"sa" -P""''/*********** 导入ExcelSELECT * FROM OpenDataSource( ''Microsoft.Jet.OLEDB.4.0'',''Data Source="c:\tes
阅读全文
摘要:一、单语句表值函数ALTER function [dbo].[uf_get_jxc_da_sum](@dt char(8),@dt2 char(8))RETURNS table asreturn( select aa.outlet_id,aa.store_id as storespace_id,aa.supp_id as supplier_id,aa.aid, aa.q as curr_q, aa.ea as curr_ea , aa.ra as curr_ra,aa.dj_ea as curr_dj_ea, quota_q ,quota_ea ,quota_...
阅读全文
摘要:create procedure sp_clearmemasbegin dbcc freeproccache dbcc freesessioncache dbcc freesystemcache('all') dbcc dropcleanbuffers exec sp_configure 'max server memory',256 exec('reconfigure') waitfor delay '00:00:05' exec sp_configure 'max server memory',21474836
阅读全文
摘要:SELECT session_id, request_id, start_time, status, command, sql_handle--,statement_start_offset, statement_end_offset, plan_handle, database_id, user_id --,connection_id, blocking_session_id, wait_type, wait_time, last_wait_type, wait_resource, open_transaction_count, open_resultset_count, transacti
阅读全文

浙公网安备 33010602011771号