随笔分类 - sqlserver
摘要:SELECT * from ::fn_dblog (null, null)
阅读全文
摘要:SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO ALTER PROCEDURE USP_CREATE_TXTFILE(@FILENAME VARCHAR(200)) AS BEGIN DECLARE @STRCMD VARCHAR(2048), @fs int, @ole int, @file int --删除存在的文...
阅读全文
摘要:聚集索引和非聚集索引的区别 聚集索引:物理存储按照索引排序 非聚集索引:物理存储不按照索引排序 优势与缺点 聚集索引:插入数据时速度要慢(时间花费在“物理存储的排序”上,也就是首先要找到位置然后插入) 查询数据比非聚集数据的速度快
阅读全文
摘要:------------------------------------- --http://topic.csdn.net/u/20080421/19/39947104-ab22-4b4a-9133-bc0e274c06ed.html ------------------------------------- SQL SERVER 与ACCESS、EXCEL的数据转换 熟悉SQL SE...
阅读全文
摘要:--dbcc checktable(CURR_DA_SALE_DATA,repair_rebuild)--修复表 --DBCC CHECKDB(lqbh,REPAIR_ALLOW_DATA_LOSS) --修复库
阅读全文
摘要:--排序(聚集索引) create clustered index inx_entry_stock_bi on entry_stock_d(entry_stock_bi) --创建非聚集索引 create nonclustered index inx_entry_stock_on entry_stock_d(entry_stock_bi) --主键 alter table entry_stock_...
阅读全文
摘要://读出设备名字restore FILELISTONLY from disk='D:\temp\databak' //还原数据库restore database singlepos from disk='D:\temp\databak'with move 'CHAIN_OL_DEV_Data' to
阅读全文
摘要:declare @outlet_type varchar(50), @outlet_type_id varchar(3),--单一门店类型 @pos int set @outlet_type='001,002,003' set @outlet_type=@outlet_type+',' while (CHARINDEX(',',@outlet_type)>0)begin set @po...
阅读全文
摘要:--备份数据库到另外一台pc上xp_cmdshell 'net use \\192.168.0.117\backup mxhzmm /user:mxh'backup database lqbh to disk='\\192.168.0.117\backup\lqbh.bak' with init--0、如何让数据库质疑(可以移除日志文件)--1、设置允许直接修改系统表--2、设置数据库为紧急修复模式(只读\置疑\脱机\紧急模式)update sysdatabases set status=-32768 where name='emanage'--
阅读全文
摘要:use 数据库dump transaction 数据库 with no_logbackup log 数据库 with no_logdbcc shrinkdatabase(数据库)--下面是sqlserver2008的方法USE [master]GOALTER DATABASE arpdb SET RECOVERY SIMPLE WITH NO_WAITGOALTER DATABASE arpdb SET RECOVERY SIMPLE --简单模式GOUSE arpdbGODBCC SHRINKFILE (N'arpdb_Log' , 11, TRUNCATEONLY)GOUS
阅读全文
摘要:SELECT tableName, colOrder, colName, IsIdentity, pKey, type, bits, length, digit, IsNullAble, defaultValue, memo,ltrim(rtrim(tableName))+'.'+ltrim(rtrim(colName)) as col from(SELECT d.name as t...
阅读全文
摘要:--压缩日志及数据库文件大小 /*--特别注意 请按步骤进行,未进行前面的步骤,请不要做后面的步骤 否则可能损坏你的数据库. --*/ 1.清空日志 DUMP TRANSACTION 库名 WITH NO_LOG 2.截断事务日志: BACKUP LOG ...
阅读全文
摘要:参考: http://support.microsoft.com/default.aspx?scid=kb;zh-cn;827422#4 如何解决 SQL Server 2000 中的连接问题 SQL Server连接中的四个最常见错误: 一."SQL Server 不存在或访问被拒绝" 这个是最复...
阅读全文
摘要:create index pk_dt_aid on article_jxc_da(dt,aid)
阅读全文
摘要:backup database rawz_ol to disk='e:\rawz_ol.bak'--备份数据库select 'truncate table ' + name +'; -- select * from '+ name from sysobjects where xtype ='u'--删除所有表
阅读全文
摘要:select 'D01' outlet_id,department_id,nameFROM OPENDATASOURCE( 'SQLOLEDB', 'Data Source=10.0.0.50;User ID=sa;Password=password' ).distcenter.dbo.department
阅读全文

浙公网安备 33010602011771号