随笔分类 -  SQL Server

T-SQL 总结
摘要:SP0_AddLinkedServer.sql [创建Linked SQL Server]USE [master]GOif exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SP_Temp_AddLinkedServ... 阅读全文
posted @ 2015-08-26 14:41 zencorn 阅读(178) 评论(0) 推荐(0)
SQLServer2005 remove log file.
摘要:Issue: SQL server does not work when the log file occupied all the disk space.Resolution: Remove the LOG file data .Step:1. Backup your database.2. Detach your database.3. Check the close connection box.4. Remove you log file or rename itfrom the data path.5. Attach you DB mdf again.6. Remove the LD 阅读全文
posted @ 2012-02-13 13:46 zencorn 阅读(367) 评论(0) 推荐(0)
SQL Query XML column.   SQL 查询 xml 字段
摘要:Work by Jianfei is licensed under a Creative Commons wei 3.0 Unported License. 1. As we knew SQL Serverhas provided a serices of XML execution function, we can using SQL query to get the field values directly. Please see following steps to create your own SQL xml query statement.-- Get the XML colum 阅读全文
posted @ 2011-05-19 14:44 zencorn 阅读(481) 评论(0) 推荐(0)
Get all tables list form current DB.
摘要:SELECT name From sysobjects WHERE xtype = 'u' 阅读全文
posted @ 2011-03-28 14:40 zencorn 阅读(176) 评论(0) 推荐(0)
SQL Profiler Practice.
摘要:1. Microsoft SQL Server 2008R2->Performance Tools->SQL Server Profiler.2. Before start to run a new Trace for you DB you should to get you DB id by this way; usemasterSELECT*FROMsysdatabasesWHEREname='DBName'3. Create a new trace. 4. There has a lot of event and history in list, so we 阅读全文
posted @ 2011-03-24 11:01 zencorn 阅读(205) 评论(0) 推荐(0)
Java Ant - SQLExec .SQL File
摘要:Work by Jianfei is licensed under a Creative Commons wei 3.0 Unported License. Goal: Using java torun one SQL script file directly .Resource : Download the Java-Ant jar package from http://ant.apache.org/bindownload.cgiCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHi 阅读全文
posted @ 2011-01-27 16:39 zencorn 阅读(1201) 评论(0) 推荐(0)
Create SQL server job with SQL SERVER.
摘要:1. Make sure you SQL Server version by using some T-SQL .[代码]2. Right click SQL Server Agent node in SQL Management Studio, then create new SQL job, paste you T-SQL into command area.代码 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--declare@filename 阅读全文
posted @ 2010-12-17 14:17 zencorn 阅读(344) 评论(0) 推荐(0)
SQL Server DBCC & Count (*) Count(1) ,Select Count(column)
摘要:[代码]DBCC (Transact-SQL) MSDNTransact-SQL 编程语言提供 DBCC 语句作为 SQL Server 的数据库控制台命令。数据库控制台命令语句可分为以下类别。命令类别 执行 维护对数据库、索引或文件组进行维护的任务。杂项杂项任务,如启用跟踪标志或从内存中删除 DLL。信息收集并显示各种类型信息的任务。验证对数据库、表、索引、目录、文件组或数据库页的分配进行的验证... 阅读全文
posted @ 2010-07-19 13:17 zencorn 阅读(262) 评论(0) 推荐(0)
SQL2008 T-SQL Note
摘要:1. INNER JOIN[代码]2. INSERT INTO  2.1 不带列名插进数据   INSERT INTO TestTable   VALUES("Test1","2005-06-12") // TestTable 第一列为ID,SQL自动从第二列开始INSERT DATA 2.2 有列名   INSERT INTO TestTable (Col5,Col3,Col4)   VALU... 阅读全文
posted @ 2010-05-27 17:27 zencorn 阅读(217) 评论(0) 推荐(0)
SQL Server 汉字 问号
摘要:关于SQL server2005中插入汉字变成问号的解决办法 1、右击你所建的数据库,点击“属性”,选择“选项”并点击。将其中的排序规则设置为:Chinese_PRC_CI_AS(选择下拉列表框即可设置),然后“确定“。 2、在表中将你的汉字字段的数据类型设置为nvarchar型或ntext型,设置前最好先将表中的数据全部删除... 阅读全文
posted @ 2010-04-27 16:34 zencorn 阅读(779) 评论(0) 推荐(0)