随笔分类 - db
摘要:sql server数据库提供了三种恢复模式:完整,简单和大容量日志,这些模式决定了sql server如何使用事务日志,如何选择它要记录的操作,以及是否截断日志。截断事务日志是删除己执行事务并把该日志空间让给新事务的过程,下面是各种恢复模式的定义:1,完整sql server恢复模式:数据库引...
阅读全文
摘要:通过下面的语句可以查看当前库中有哪些表是发生死锁的:SELECT request_session_id spid,OBJECT_NAME(resource_associated_entity_id)tableName FROM sys.dm_tran_locks WHERE resource_type='OBJECT '
阅读全文
摘要:The Object Model and Domain Model patterns are often considered to refer to thesame thing. They may initially look exactly the same, because both carry dataextracted from storage. But after digging a bit, you’ll find that they have differences:the object model contains only the data, whereas the dom
阅读全文
摘要:1. 查看数据库的版本 select @@version 2. 查看数据库所在机器操作系统参数 exec master..xp_msver 3. 查看数据库启动的参数 sp_configure 4. 查看数据库启动时间 select convert(varchar(30),login_time,120) from master..sysprocesses where spid=1 查看数据库服务器名和实例名 print 'Server Name...............:' + convert(varchar(30),@@SERVERNAME) p...
阅读全文
摘要:比如有语句selectusernamefromEmployee返回结果是:username张三李四王五怎么输出一个字符串类似:张三,李四,王五答:declare @s varchar(1000)select @s=isnull(@s+',','')+username from Employeeselect @s as username---------------------------------------------------------------------------- Author : htl258(Tony)-- Date : 2010-03-
阅读全文
摘要:表达式:是常量、变量、列或函数等与运算符的任意组合。以下参数中表达式类型是指表达式经运算后返回的值的类型字符串函数函数名称参数示例说明ascii(字符串表达式)select ascii('abc') 返回 97返回字符串中最左侧的字符的 ASCII码。char(整数表达式)select char(100) 返回 d把ASCII 码转换为字符。介于 0 和 255 之间的整数。如果该整数表达式不在此范围内,将返回 NULL 值。charindex(字符串表达式1,字符串表达式2[,整数表达式])select charindex('ab','BCabTabD
阅读全文
摘要:/***2005以上版本有效***/CREATE procedure [dbo].[GetFolderChilds]( @folderid uniqueidentifier)asbeginwith T as(SELECT * FROm Doc_Folder where FolderID = @folderidunion allselect a.* from Doc_Folder a join T b on a.ParentFolderID = b.FolderID)select * from Tendreturn GO
阅读全文

浙公网安备 33010602011771号