• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






ghelement

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理
上一页 1 2 3 4 5 6 ··· 8 下一页

2021年3月15日

sql 设置每周开始日期
摘要: SET DATEFIRST 1 SELECT DATEPART(WEEKDAY,GETDATE()) 阅读全文
posted @ 2021-03-15 10:33 ghelement 阅读(132) 评论(0) 推荐(0)
 

2021年1月6日

sql 制表(\t),换行(\n),回车(\r)
摘要: CHAR(9),CHAR(10),CHAR(13) 需要换行简单的在写入或者查询的时候拼接 select a + char(10) + b from tableA 阅读全文
posted @ 2021-01-06 16:35 ghelement 阅读(1095) 评论(0) 推荐(0)
 
sql 星期排序
摘要: create table #AA ( a varchar(10) ) select * from #AA insert into #AA (a) values ('星期二'),('星期三'),('星期一'),('星期五'),('星期四'),('星期日'),('星期一') select * from 阅读全文
posted @ 2021-01-06 16:28 ghelement 阅读(317) 评论(0) 推荐(0)
 

2020年5月29日

关联其他表的 delete
摘要: delete.table_A from table_A a join #table_scr b on a.id= b.id AND a.sID= b.sID 阅读全文
posted @ 2020-05-29 11:40 ghelement 阅读(189) 评论(0) 推荐(0)
 

2019年8月28日

sql 验证码生成和补位
摘要: declare @a int = 0,@b varchar(10) = '' CREATE TABLE #temp2 ( vcCode varchar(10), nStatus int ) while(@a < 10000) begin --随机数生成(不推荐) --set @b = right('000'+cast(ceiling(rand() * 10000) as varchar),4) s 阅读全文
posted @ 2019-08-28 11:49 ghelement 阅读(311) 评论(0) 推荐(0)
 

2019年6月24日

查找Proc中涉及到的内容
摘要: SELECT obj.Name AS 存储过程名, sc.TEXT as 存储过程内容 FROM syscomments sc INNER JOIN sysobjects obj ON sc.Id = obj.ID WHERE sc.TEXT LIKE '%请输入要查找的内容%' AND TYPE 阅读全文
posted @ 2019-06-24 14:31 ghelement 阅读(180) 评论(0) 推荐(0)
 

2018年9月27日

一次写入多行
摘要: insert into tb(a,b,c) select 'a','b','c' union all select 'd','e','f' union all select 'x','y','z' insert into tableName (列名1,列名2,列名3,列名4) values (值1,值2, 值3, 值4), (值1,值2, 值3, 值4), (值1,值2, 值3, 值4) ... 阅读全文
posted @ 2018-09-27 14:57 ghelement 阅读(140) 评论(0) 推荐(0)
 

2018年8月14日

update结合查询更新
摘要: UPDATE a SET a.nstuId=b.bStuID FROM TableA a INNER JOIN ( SELECT * FROM ( SELECT a.nTID,a.vcCtor, a.nStuID,isnull(b.nStuID,0) AS bStuID,a.dtCTime FROM 阅读全文
posted @ 2018-08-14 16:37 ghelement 阅读(242) 评论(0) 推荐(0)
 

2017年11月6日

查表字段名,注释
摘要: SELECTA.name AS table_name,B.name AS column_name,C.value AS column_descriptionFROM sys.tables AINNER JOIN sys.columns B ON B.object_id = A.object_idLE 阅读全文
posted @ 2017-11-06 15:51 ghelement 阅读(176) 评论(0) 推荐(0)
 

2017年10月19日

关于proc索引的创建
摘要: select ,update的字段、order by 、group by 放 Include。where条件中的放on 对于关联语句中的on,当有语句有where条件时放include,当没有where时放在on DROP_EXISTING = ON 删除与创建索引名称相同的索引,可用作对索引的修改 阅读全文
posted @ 2017-10-19 16:38 ghelement 阅读(196) 评论(0) 推荐(0)
 
上一页 1 2 3 4 5 6 ··· 8 下一页