随笔分类 -  SqlServer

日期显示
摘要:SQL语句截取时间,只显示年月日(2004-09-12) select CONVERT(varchar, 字段名, 120 ) eg:select convert(varchar(11),vc_createdate,120) '日期' from table 扩展:其他格式 select CONVER 阅读全文
posted @ 2020-03-25 17:50 龙族少年 阅读(182) 评论(0) 推荐(0)
字符串截取
摘要:SET @I = '12-办公室'SELECT SUBSTRING(@I,CHARINDEX('-',@I) + 1,LEN(@I) - CHARINDEX('-',@I)) 结果:办公室 declare @str nvarchar(50);set @str='462,464,2';select @ 阅读全文
posted @ 2020-03-25 17:48 龙族少年 阅读(261) 评论(0) 推荐(0)
启用与关闭 Ad Hoc Distributed Queries
摘要:在数据库里执行以下脚本: 启用: exec sp_configure 'show advanced options',1reconfigureexec sp_configure 'Ad Hoc Distributed Queries',1reconfigure 关闭: exec sp_configu 阅读全文
posted @ 2016-12-14 16:34 龙族少年 阅读(222) 评论(0) 推荐(0)