SQL Server essence

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2009年4月15日

摘要: 在SQL SERVER中,不要将变量和参数弄混淆了,即使他们的语法几乎相同: 1. 一个变量的值在一条SQL语句被真正执行之前永远是未知的,在编译时也是未知的。 2. 传递给存储过程的参数值在编译时是已知的,因为直到存储过程参数被赋值并且被真正调用,该存储过程才被编译和优化! 原文: Don't confuse variables with parameters even though the... 阅读全文
posted @ 2009-04-15 16:33 天蝎 阅读(244) 评论(0) 推荐(0) 编辑

摘要: The "Not For Replication" setting for identity columns allows replication to pass the ID value from the publisher to the subscriber without the subscriber creating a new ID. Since identity columns wi... 阅读全文
posted @ 2009-04-15 12:00 天蝎 阅读(208) 评论(0) 推荐(0) 编辑

摘要: 原文出处:http://topic.csdn.net/t/20050602/13/4053922.html --测试环境,SQL Server2000,远程服务器名:xz,用户名为:sa,无密码,测试数据库:test --服务器上的表(查询分析器连接到服务器上创建) create table [user](id int primary key,num... 阅读全文
posted @ 2009-04-15 11:42 天蝎 阅读(494) 评论(0) 推荐(0) 编辑

摘要: 原文出处:http://topic.csdn.net/t/20050602/13/4053922.html 测试环境及同步要求: 有数据库服务器srv1和srv2,两台电脑能互相访问,有数据 srv1.库名..author有字段:id,name,phone, srv2.库名..author有字段:id,name,telphone,adress ... 阅读全文
posted @ 2009-04-15 11:29 天蝎 阅读(347) 评论(0) 推荐(0) 编辑

2009年4月8日

摘要: 例如:得到当前用户的query: DECLARE @Handle binary(20) SELECT @Handle = sql_handle FROM sys.sysprocesses WHERE spid = @@spidSELECT * FROM ::fn_get_sql(@Handle) go 阅读全文
posted @ 2009-04-08 17:53 天蝎 阅读(805) 评论(0) 推荐(0) 编辑

2009年3月19日

摘要: Please keep in mind that: "MOVE TO clause is only available with ALTER TABLE when you do a DROP CONSTRAINT". It is not available with ALTER TABLE on its own. The command will look like this: alte... 阅读全文
posted @ 2009-03-19 12:34 天蝎 阅读(896) 评论(0) 推荐(0) 编辑

2009年3月18日

摘要: --How to grant a user the access to create a table in a new schema use tempdb go create login u1 with password = 'Mdfjd$sakj943857l7sdfh##30' create user u1 with default_schema = u1 go grant crea... 阅读全文
posted @ 2009-03-18 12:02 天蝎 阅读(251) 评论(0) 推荐(0) 编辑

2008年4月9日

摘要: --引自《刘辉的博客:http://anywolfs.com/liuhui/article.asp?id=210》 Usage :: ROBOCOPY source destination [file [file]...] [options] 使用规则:robocopy 源目录 文件 参数 source :: Source Directory... 阅读全文
posted @ 2008-04-09 16:56 天蝎 阅读(1081) 评论(0) 推荐(0) 编辑

2008年3月27日

摘要: if exists(select * from sys.objects where name like 'sp_waitfordbonline' and type ='P') drop procedure sp_waitfordbonlinego create procedure sp_waitfordbonline @dbname varchar(30), @timeout int as beg... 阅读全文
posted @ 2008-03-27 12:25 天蝎 阅读(176) 评论(0) 推荐(0) 编辑

2008年2月24日

摘要: C:"WINDOWS"Microsoft.NET"Framework"v2.0.50727>MSBuild.exe Microsoft (R) Build Engine Version 2.0.50727.832 [Microsoft .NET Framework, Version 2.0.50727.832] Copyright (C) Microsoft Corporation 2005.... 阅读全文
posted @ 2008-02-24 21:25 天蝎 阅读(852) 评论(0) 推荐(0) 编辑