查看SQL Server日志的方法
转自http://blog.csdn.net/ziren235/archive/2007/07/03/1676347.aspx
在SQL Server2000中,一个数据库的日志是以*.ldf 文件存放,请问我想查看某一个数据库的日志,该如何操作.
方法1、
DBCC LOG('DatabaseName',2)
方法2:
select * from ::fn_dblog(default,default)
方法3
用Log Explorer
相关文档:
1、 存储过程
1) 尽量将代码段放到TRY…CATCH…。
但凡使用C#写过代码的人,都知道C#中TRY…CATCH…的运行和出错跳转逻辑,而SQL Server2005中,其运行和出错跳转逻辑与在C#中是一致的。TRY…CATCH…是SQL Server2005中新增的,功能强大,且很好用。
2)&nb ......
要创建两个文件
1: runBatch.bat
2: sql.txt
runBatch.bat 内容如下:
sqlplus username/password @sql.txt
pause
sql.txt内容如下:
spool sql.log
create table t1(cname char(20));
insert into t1(cname) values('test');
select * from t1;
spool off
exit
双击runBatch.bat就可以批量执行sql.txt中 ......
如果你使用的是 SQL Server 2008, 当你修改数据结构后,保存时会报下图情况: Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving cha ......
怎样从数据库里随机读取
一条记录,
SELECT TOP 1 * from dbo.Customers ORDER BY NEWID()
这样,如果是随机10
条,100条。。。。
SELECT TOP 10 * from dbo.Customers ORDER BY NEWID()
很简单吧。
不过top后面数字越大,运行速度越慢。不推荐数据字太大。
以后代码在SQL2000 ......