上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 102 下一页
摘要: set nocount ondeclare @lock table(spid int,dbid int,objid int,indid int,type varchar(6),resource varchar(max),mode varchar(200),status varchar(200))declare @loclinfo table(EventType varchar(max),Parameters int,EventInfo varchar(max))declare @sql table (sql varchar(max))insert @lock exec sys.sp_lock; 阅读全文
posted @ 2012-05-04 09:52 qanholas 阅读(314) 评论(0) 推荐(0)
摘要: declare @TableType varchar(max) =''declare @tablename varchar(max)set @tablename='student'select @TableType=@TableType +case when types.name in ('varchar','nvarchar','char','nchar','varbinary') then '['+columns.name+']'+' &# 阅读全文
posted @ 2012-05-04 09:15 qanholas 阅读(227) 评论(0) 推荐(0)
摘要: 最近在项目中进行压力测试遇到了数据库的死锁问题,简言之,如下的代码在 SERIALIZABLE 隔离级别造成了死锁:?1234567891011121314SELECT @findCount=COUNT(id) FROM MyTableWHERE [fk_related_id]=@ArgumentIF (@findCount > 0)BEGINROLLBACK TRANSACTIONRETURN ERROR_CODEENDINSERT INTO MyTable ([fk_related_id],…)VALUES (@Argument,…)COMMIT TRANSACTIONRETURN 阅读全文
posted @ 2012-05-02 17:26 qanholas 阅读(7479) 评论(0) 推荐(1)
摘要: CLR函数脚本---------------------------------------------------------------------------------using System;using System.Data;using System.Data.SqlClient;using System.Data.SqlTypes;using Microsoft.SqlServer.Server;using System.Collections;/// <summary>/// 用户自定CLR 函数,用来生成一个序列/// </summary>public 阅读全文
posted @ 2012-05-02 12:03 qanholas 阅读(1745) 评论(3) 推荐(0)
摘要: “在 master 数据库中记录的数据库所有者 SID 与在数据库 '**' 中记录的数据库所有者 SID 不同。应该通过使用 ALTER AUTHORIZATION 语句重置数据库 '*' 的所有者来更正此情况。 ” 解决:Sp_changedbowner 'sa',true --sa为需要使用的用户名,在相应的数据库中执行即可 阅读全文
posted @ 2012-05-02 10:05 qanholas 阅读(5602) 评论(0) 推荐(0)
上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 102 下一页