随笔分类 - SQL
摘要:REF: https://blog.csdn.net/weixin_30745641/article/details/101745371?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_rele
阅读全文
摘要:ref:https://www.cnblogs.com/cy163/archive/2008/10/16/1312920.html 2.3.4 外连接与条件配合使用当在内连接查询中加入条件是,无论是将它加入到join子句,还是加入到where子句,其效果是完全一样的,但对于外连接情况就不同了。当把条
阅读全文
摘要:https://clouddamcdnprodep.azureedge.net/gdc/gdcJivzXl/original
阅读全文
摘要:例子: CREATE TABLE [dbo].[testDT]( [bh] [varchar](50) NULL, [name] [varchar](50) NULL, [gender] [int] NULL, [email] [varchar](50) NULL ) 测试数据:12 li 1 12
阅读全文
摘要:在SQL SERVER 2008R2的[AdventureWorks2008R2]示例数据库中,看到以下字段统一补0方法。 将CustomerID前面加0转变为AccountNumber字段。 CREATE TABLE [Sales].[Customer]( [CustomerID] [int] I
阅读全文
摘要:解决方案/Solution: 报错描述: SQL Service BI development studio 创建新项目时,报错:(报错截图如下) Microsoft visual studio is unable to load this document.To design Integratio
阅读全文
摘要:SQL SERVER 2008 安装过程中, 进行到server configuration步骤, 报错 “The credentials you provided for the SQL Server Agent service are invalid.”解决方案如下: 报错内容示例: The s
阅读全文
摘要:现在有excel一些数据,需要复制到table中。 Period TransDate Amount2018001 2018-01-02 -4013.22 将excel中日期格式设置为自定义yyyy-mm-dd。举例,当你在excel中设置自定义格式为mm/dd/yyyy, sql server默认的
阅读全文
摘要:MS SQL处理“分子分母都有除法式”方法,避免devide by zero error: eg: 有4列值,分别为A,B,C,D.我们需要求(A/B)/(C/D)的值作为新的一列。 只用ISNULL处理,可能会报错devide by zero error. “divide by zero” err
阅读全文
摘要:SQL中把筛选条件放在left outer join的on 和 where 后面的区别 create table [Table_1]([PKey] int,[FKey] int,[value1] int,[value2] int)create table[Table_2]([PKey] int,[v
阅读全文
摘要:报错:TITLE: Connect to Server------------------------------Cannot connect to XXXXX.------------------------------ADDITIONAL INFORMATION:A network-relate...
阅读全文
摘要:[.net] 关于CS0016: Could not write to output file ‘c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files… ‘Access is denied.’ 的解决办法1、添加用...
阅读全文
摘要:"Chinese_PRC_CI_AS" and "SQL_Latin1_General_CP1_CI_AS"
无法解决 equal to 操作中 "SQL_Latin1_General_CP1_CI_AS" 和 "Chinese_PRC_CI_AS" 之间的排序规则冲突。
阅读全文
摘要:So for today’s blog post, we will concentrate on 4 different reports:Top Queries by Average CPU TimeTop Queries by Total CPU TimeTop Queries by Averag...
阅读全文
摘要:/*Goal:MS SQL SERVER:Output all the field and its’ tableauthor:AllisonHuangcreated date :20140613*/--select [id], [name] from [sysobjects] where [type...
阅读全文
摘要:比较SQL查询性能 语句--优先使用SET STATISTICS IO和SET STATISTICS TIME查看性能调节是否有效。--SET STATISTICS TIME ON--SET STATISTICS TIME ON在开始我们的例子前,先运行下面的这二条命令(不要在正在使用的服务器上执行...
阅读全文
摘要:1.获取所有数据库名--SELECT Name FROM Master..SysDatabases ORDER BY Name --2.获取所有表名:--SELECT Name NAMEtemp,* FROM TEST..SysObjects Where XType='U' ORDER BY Nam...
阅读全文
摘要:主键相关--删除altertable你的表dropconstraint主键名go--修改ALTERTABLE你的表ALTERCOLUMN列名你的类型go--增加altertable你的表addconstraint主键名primarykey(列名)go-------------------------...
阅读全文
摘要:如果只想备份或恢复单个表而不想备份或恢复整个数据库的话,往往有以下方法:1.在Sql server2000 中可以使用DTS来将该表的数据导出成另外的文件格式.当需要恢复时,可以将该文件中数据再通过DTS导入;或者建立DTS脚本来完成2.使用命令bcp:导出到filename文件中:Master.....
阅读全文