随笔分类 - SQL
SQL,SQL2005/2008
    
摘要:近期一个老系统改用SQL Server 2005数据库, 从原来的2000改为2005, 默认情况下启动出错:Incorrect syntax near 'Index'. If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required.SQL 语句中的table hint ...
        阅读全文
            
摘要:create nonclustered index [NC_Index_CA]on sales.customers( [state] asc)where state = 'CA'
        阅读全文
            
摘要:新装了SQL Server 2008 R2, 还没有试用其中新功能,不过发现MS终于修复了SQL 查询分析器的Bug,以前在SQL Query 里 Create一个新的sp, 其他的SQL Query里无法感知新创建的sp对象,除非重新打开Management Studio.现在的R2里这个问题看来已经解决好了
        阅读全文
            
摘要:数据库的ldf文件丢失或损坏,则数据库加载失败, 查看SQL Server Management->SQL Server Logs,可以看到加载ldf失败。1.查看数据库状态select * from sys.databases可以看到对应的数据库的state_desc为Recovery在后面的步骤中可以随时查看数据库状态2. 允许数据库更新Sp_configure 'allow updat...
        阅读全文
            
摘要:1、在SQL查询分析器中执行以下语句 use msdbdbcc checkdb 2、查看查询结果,有很多红色字体显示,最后结果有这样的提示: CHECKDB 发现了x个分配错误和 x 个一致性错误(在数据库'msdb'中)。 一般情况下,引起分配错误的原因是磁盘损坏或突然停电;一致性错误可能是数据库中的表或索引坏,一般都可修复. 3、查看红色字体,并把有错误的数据库表名记录下来,或把索引损坏的表...
        阅读全文
            
摘要:昨天装好SQL Server 2008 Enterprise RTM,试用下来感觉挺爽的 发现现在T-SQL可以打点下拉了,不错 但是发现一个问题,如果我先create一个sp,然后调用的话,编辑器总是说could not find store procedure(当然执行没有问题). 关掉重新开一下就好了,不知道怎么解决,也许是一个bug. 还有一个很有用的功能,现在Management Stu...
        阅读全文
            
摘要:create function f_split(@SourceSql varchar(max),@StrSeprate char(1))returns @temp table(a varchar(100))--实现split功能 的函数as begin --declare @temp as table(a varchar(100))--declare @SourceSql as nvarch...
        阅读全文
            
摘要:1.unpivot with T(LOTNO, IDName, DepartmentCode, OperateType, State, ModTime, C1_001_001, C1_001_002, [Value], CreateTime, GetTime, FinishTime, Status) as ( select lower(newid()),IDName,@DepartmentCode...
        阅读全文
            
摘要:如何从数据库中删除全文目录 (SQL Server Management Studio) 本主题说明了如何使用 SQL Server Management Studio 从数据库中删除全文目录。 从数据库中删除全文目录 在对象资源管理器中,展开服务器组,展开“数据库”,然后展开要删除的全文目录所在的数据库。 展开“存储”,然后展开“全文目录”。 右键单击要删除的全文目录,然后选择“删...
        阅读全文
            
摘要:Error: The backup of full-text catalog 'BTACScotFT' is not permitted because it is not online. Check errorlog file for the reason that full-text catalog became offline and bring it online. Or BACKUP c...
        阅读全文
            
摘要:不允许使用内部子集 DTD 分析 XML。请将 CONVERT 与样式选项 2 一起使用,以启用有限的内部子集 DTD 支持 在xml data中包含DTD 头,则使用convert(xml,xmldatafield,2) declare @x as xml select @x=convert(xml,ServiceContent,2) FROM MessagesToLOB where PI...
        阅读全文
            
摘要:How to: Rename a Computer that Hosts a Stand-Alone Instance of SQL Server 2005 1. For a renamed default instance, run the following procedures:Get SQL SERVER NAME: select @@servername sp_dropserver ...
        阅读全文
            
摘要:查阅了MSDN,其实很简单sp_xml_preparedocument hdoc OUTPUT [ , xmltext ] [ , xpath_namespaces ] You can specify ns using the third parameter. declare @MailContent as nvarchar(max)select @MailContent=MessageBo...
        阅读全文
            
摘要:今天从MS Connect上down了BizTalk 2006 R2 beta安装看看,做了差异盘,准备安装在虚机里,刚开机发现机器名重名,没办法,用的是同一个母盘,想当然改机器名了,结果这回麻烦了,sql server里的job起不来了,后来查到,原来数据库中的server name没有改过来 Error: Error 14274 Cannot add, update or delete a j...
        阅读全文
            
摘要:郁闷,msn上不去,没法干活。记上最近项目中用到的一些code snippet1.查询今天的记录select datediff(dd,ConvDateTime,getdate()),* from dbo.rbConversationMaster where datediff(dd,ConvDateTime,getdate())=0 DataDiff Returns the number of da...
        阅读全文
            
摘要:升级到SQL Server 2005,一直没找到原来的DTS,原来现在是Integration Services 替代了原来的DTS,呵呵,当时不知道这是什麽东西,没有安装,现在补装上;今天做了个最简单的DTS数据库的复制工作1.打开Visual Studio 2005,或者从开始菜单Microsoft SQL Server 2005中打开SQL Server Business Intellige...
        阅读全文
            
摘要:a previous program installation created pending file operations,you must restart the computer before running setupPRB:SQL Server 2000 安装失败并给出"...previous program installation..."错误信息症状当您安装 SQL Server ...
        阅读全文
            
 
                     
                    
                 
                    
                 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号