看个sql文的结果select '2015-12-03 23:59:59.999' + ' will stored into db like :' + convert(varchar, convert(datetime, '2015-12-03 23:59:59.999'),121)union allselect '2015-12-03 23:59:59.998' + ' will stored into db like :' + convert(varchar, convert(datetime, '2015-12-...【阅读全文】
SimilarityBoth the functions accepts two arguments to search the specified text filed in the given expression.Both the function returns the starting position of the matching pattern given in the function.DifferenceThe PatIndex function is used with the wildcard characters. You must enclosed t...【阅读全文】
简述一下2个SQL 是否有区别a) select * from g_cardapply where g_applydate like '2011-01-01%' ;b) select * from g_cardapply where g_applydate >= '2011-01-01 00:00:00' and g_applydate <= '2011-01-01 23:59:59;______________________________1______________________________方法a无法匹...【阅读全文】
Demo DatabaseIn this tutorial we will use the well-known Northwind sample database.Below is a selection from the "Customers" table:CustomerIDCustomerNameContactNameAddressCityPostalCode...【阅读全文】
迭代检索原理就是WITH语句做一个临时表【DAYS】,在UNION ALL的下半部分从【DAYS】临时表中检索YMD的前一天,当【DAYS】表中的YMD大于等于当前日期的前10天迭代停止WITH DAYS AS (SELECT CURRENT_TIMESTAMP AS YMD UNION ALL SELECT DATEADD(Y, -1, YMD) FROM DAYS WHERE DAYS.Y...【阅读全文】
配置镜像的时候,错误的将主数据库设置成了“SINGLE_USER”模式。由于是生产环境,刚设置完就有用户登录了,造成了无法通过设置更改为“MULTI_USER"模式,此情况必须清除掉主数据库中的用户连接,然后再进行更改,语句如下: USE master; GO DECLARE @SQL VARCHAR(MAX); SET @SQL='' SELECT ...【阅读全文】
日志传送模式中,主数据库故障转移到辅助数据库并将其用作新主数据库的操作步骤手动从主数据库故障转移到辅助数据库, 请确保用 NORECOVERY 备份主服务器上的活动事务日志,如果主服务器已经挂掉,请跳过此步骤。BACKUP LOG database_name TO DISK = 'G:/Backups/********.b...【阅读全文】