当前位置: 首页 > news >正文

MSSQL 中 Stuff 的应用

MSSQL 中 Stuff 的应用

select stuff(stuff(convert(char(8),getdate(),112),5,0,N'Year'),11,0,N'Month')+'Day'
SELECT STUFF(STUFF(CONVERT(char(8),getdate(),112),5,0,N'年'),8,0,N'月')+N'日'


---Result---
--------------------
2008Year11Month06Day

(1 row(s) affected)


-----------
2008年11月06日

(1 row(s) affected)


STUFF
Deletes a specified length of characters and inserts another set of characters at a specified starting point.

Syntax
STUFF ( character_expression , start , length , character_expression )

Arguments
character_expression

Is an expression of character data. character_expression can be a constant, variable, or column of either character or binary data.

start

Is an integer value that specifies the location to begin deletion and insertion. If start or length is negative, a null string is returned. If start is longer than the first character_expression, a null string is returned.

length

Is an integer that specifies the number of characters to delete. If length is longer than the first character_expression, deletion occurs up to the last character in the last character_expression.

Return Types
Returns character data if character_expression is one of the supported character data types. Returns binary data if character_expression is one of the supported binary data types.

Remarks
String functions can be nested.

Examples
This example returns a character string created by deleting three characters from the first string (abcdef) starting at position 2 (at b) and inserting the second string at the deletion point.

SELECT STUFF('abcdef', 2, 3, 'ijklmn')
GO

Here is the result set:

---------
aijklmnef

(1 row(s) affected)

相关文章:

  • 最大独立匹配_射频电路设计中阻抗匹配的必要性
  • SQL日期推算...
  • python强制关闭线程_在python中实现强制关闭线程的示例
  • ABAP將數字輸出前面補0
  • potplayer哪个版本最好用_市面上有多少云手机?哪个最好用?
  • ABAP两个非法修改系统程式的方法...
  • python作者 es6_Es6 写的文件import 起来解决方案详解
  • route命令详解_程序员必备的学习笔记《TCP/IP详解》IP选路、动态选路、UDP 协议...
  • 5分钟让你整明白美国金融危机爆发的原因
  • python中字典copy_python中字典、元祖、浅拷贝、深拷贝
  • javascript在IE和Firefox中的兼容考虑
  • python计算两字符串中的位置,从Python中的字符串中获取两个字符
  • 读者skyfalling:《.NET 2.0面向对象编程揭秘》读后有感
  • sql查询行数_千万级数据表选错索引导致的线上慢查询事故
  • BIEE创建时间维报NQSError
  • JavaScript 如何正确处理 Unicode 编码问题!
  • 【399天】跃迁之路——程序员高效学习方法论探索系列(实验阶段156-2018.03.11)...
  • 【前端学习】-粗谈选择器
  • Koa2 之文件上传下载
  • LeetCode算法系列_0891_子序列宽度之和
  • log4j2输出到kafka
  • Logstash 参考指南(目录)
  • Promise面试题,控制异步流程
  • Python利用正则抓取网页内容保存到本地
  • Spark VS Hadoop:两大大数据分析系统深度解读
  • Tornado学习笔记(1)
  • 配置 PM2 实现代码自动发布
  • 如何实现 font-size 的响应式
  • 实习面试笔记
  • 微信端页面使用-webkit-box和绝对定位时,元素上移的问题
  • 责任链模式的两种实现
  • 怎么把视频里的音乐提取出来
  • ​力扣解法汇总946-验证栈序列
  • ​人工智能之父图灵诞辰纪念日,一起来看最受读者欢迎的AI技术好书
  • #鸿蒙生态创新中心#揭幕仪式在深圳湾科技生态园举行
  • (¥1011)-(一千零一拾一元整)输出
  • (ZT) 理解系统底层的概念是多么重要(by趋势科技邹飞)
  • (附源码)springboot优课在线教学系统 毕业设计 081251
  • (附源码)springboot掌上博客系统 毕业设计063131
  • (一)u-boot-nand.bin的下载
  • (译)计算距离、方位和更多经纬度之间的点
  • (转)es进行聚合操作时提示Fielddata is disabled on text fields by default
  • (转)JAVA中的堆栈
  • (转)大道至简,职场上做人做事做管理
  • (转)视频码率,帧率和分辨率的联系与区别
  • (转载)Linux 多线程条件变量同步
  • .chm格式文件如何阅读
  • .NET Core 网络数据采集 -- 使用AngleSharp做html解析
  • .NET Core 中插件式开发实现
  • .NET NPOI导出Excel详解
  • .NET 除了用 Task 之外,如何自己写一个可以 await 的对象?
  • .Net+SQL Server企业应用性能优化笔记4——精确查找瓶颈
  • .NET6 开发一个检查某些状态持续多长时间的类
  • .Net7 环境安装配置
  • .Net多线程总结