随笔分类 -  SQL

摘要:https://www.cnblogs.com/jkqnb/p/5949611.html1、添加表说明 EXECUTE sp_addextendedproperty N'MS_Description','表说明',N'user',N'dbo',N'table',N'表名',NULL,NULL 2、删 阅读全文
posted @ 2018-04-04 14:40 LuoCore 阅读(3800) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/liuyaozhi/archive/2015/10/14/4877987.html 1 use db_CSharp 2 go 3 select *, 4 备注=case 5 when Grade>=90 then '成绩优秀' 6 when Grade 阅读全文
posted @ 2018-04-04 12:16 LuoCore 阅读(288) 评论(0) 推荐(0) 编辑
摘要:https://zhidao.baidu.com/question/149116757.html create database stuDB on primary -- 默认就属于primary文件组,可省略 ( /*--数据文件的具体描述--*/ name='stuDB_data', -- 主数据 阅读全文
posted @ 2018-04-04 12:10 LuoCore 阅读(202) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/onsuccessway/p/3355550.html 在SQLSERVER查询分析器中,当我们用Set Statistics on 语句来统计SQL语句或者存储过程I/O的时候, SQLSERVER会显示几个概念去词语:逻辑读取,物理读取,预读。 如 阅读全文
posted @ 2018-03-31 18:04 LuoCore 阅读(413) 评论(0) 推荐(0) 编辑
摘要:http://blog.csdn.net/dxb601/article/details/52086830 update 表名 set 字段名a= Lower(字段a) 2.将小写字母转化成大写字母 update 表名 set 字段名a= upper(字段名a) update 表名 set 字段名a= 阅读全文
posted @ 2018-03-16 13:08 LuoCore 阅读(1619) 评论(0) 推荐(0) 编辑
摘要:SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'ImmediacyOutKu' 阅读全文
posted @ 2018-03-15 19:50 LuoCore 阅读(220) 评论(0) 推荐(0) 编辑
摘要:select convert(varchar(10),getdate(),120) 输出格式:2008-02-27 00:25:13 SELECT CONVERT(char(19), getdate(), 120) 输出格式:2008-02-27 SELECT CONVERT(char(10), g 阅读全文
posted @ 2018-03-15 13:06 LuoCore 阅读(667) 评论(0) 推荐(0) 编辑
摘要:string name = txtUserName.Text.Trim();//移除用户名前部和后部的空格 string pwd = txtUserPwd.Text.Trim();//移除密码前部和后部的空格 SqlConnection conn = new Sqlconnection(@"serv 阅读全文
posted @ 2018-03-14 22:15 LuoCore 阅读(244) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/lxhbky/p/5962393.html 需求:查询表dbo.Message,每页10条,查询第2页 1:TOP() SELECT TOP(20) * FROM dbo.Message WHERE Code NOT IN (SELECT TOP(10 阅读全文
posted @ 2018-02-27 18:08 LuoCore 阅读(993) 评论(0) 推荐(0) 编辑
摘要:select * from table1 where patindex('%关键字%' , aa) = 0 select * from table1 where charindex('关键字' , aa) = 0 select * from table1 where aa like '%关键字%' 阅读全文
posted @ 2018-02-27 12:14 LuoCore 阅读(2002) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/luluping/archive/2010/11/26/1888364.html 由于Sql Server对于系统内存的管理策略是有多少占多少,除非系统内存不够用了(大约到剩余内存为4M左右), Sql Server才会释放一点点内存。所以很多时候,我 阅读全文
posted @ 2018-02-01 12:29 LuoCore 阅读(782) 评论(0) 推荐(0) 编辑
摘要:https://www.cnblogs.com/srsrd/p/6962982.html 方法一: 方法二: 使用以下语句查找出什么语句占内存最高,针对占内存高的语句进行优化SELECT SS.SUM_EXECUTION_COUNT, T.TEXT,SS.SUM_TOTAL_ELAPSED_TIME 阅读全文
posted @ 2018-02-01 12:27 LuoCore 阅读(2689) 评论(0) 推荐(0) 编辑
摘要:启动:net start mssqlserver 停止:net stop mssqlserver 阅读全文
posted @ 2018-01-31 20:25 LuoCore 阅读(2469) 评论(0) 推荐(0) 编辑
摘要:SP_Lock 阅读全文
posted @ 2018-01-31 16:57 LuoCore 阅读(119) 评论(0) 推荐(0) 编辑
摘要:ALTER proc [dbo].[SP_SQL](@ObjectName sysname) as set nocount on ; declare @Print nvarchar(max) @Print用nvarchar if exists(select 1 from syscomments wh 阅读全文
posted @ 2018-01-25 15:33 LuoCore 阅读(251) 评论(0) 推荐(0) 编辑
摘要:http://bbs.csdn.net/topics/340184487 在此感谢 提供参考 CREATE TABLE ToPayFee ( Id INT IDENTITY(1,1) PRIMARY KEY, CountryID INT, MoneyStart DECIMAL(18,2) DEFAU 阅读全文
posted @ 2018-01-22 10:57 LuoCore 阅读(614) 评论(0) 推荐(0) 编辑
摘要:http://blog.csdn.net/anya/article/details/6407280/ 2、删除表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断,只留有rowid最小的记录 delete from people where peopleName in (select 阅读全文
posted @ 2017-12-26 20:21 LuoCore 阅读(192) 评论(0) 推荐(0) 编辑
摘要:http://www.yesky.com/imagesnew/software/tsql/ts_ra-rz_5ooi.htm RAISERROR 返回用户定义的错误信息并设系统标志,记录发生错误。通过使用 RAISERROR 语句,客户端可以从 sysmessages 表中检索条目,或者使用用户指定 阅读全文
posted @ 2017-12-20 13:32 LuoCore 阅读(2155) 评论(0) 推荐(0) 编辑
摘要:truncate table pmw_Invoice 阅读全文
posted @ 2017-11-16 13:41 LuoCore 阅读(297) 评论(0) 推荐(0) 编辑
摘要:http://bbs.csdn.net/topics/350135010 参考 select * from a aa left join b bb on aa.id=bb.cid and bb.adddate=(select max(adddate) from b where cid=bb.cid) 阅读全文
posted @ 2017-11-15 18:10 LuoCore 阅读(10959) 评论(1) 推荐(0) 编辑

点击右上角即可分享
微信分享提示