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)
分享到:
相关推荐
国开作业《MySQL数据库应用》实验训练1在MySQL中创建数据库和表参考107.pdf国开作业《MySQL数据库应用》实验训练1在MySQL中创建数据库和表参考107.pdf国开作业《MySQL数据库应用》实验训练1在MySQL中创建数据库和表...
MYSQL应用MYSQL应用MYSQL应用MYSQL应用MYSQL应用MYSQL应用MYSQL应用MYSQL应用
国家开放大学 MySQL数据库应用 实验训练1 在MySQL中创建数据库和表
(完整)MySQL数据库原理与应用期末考试复习资料.pdf(完整)MySQL数据库原理与应用期末考试复习资料.pdf(完整)MySQL数据库原理与应用期末考试复习资料.pdf(完整)MySQL数据库原理与应用期末考试复习资料.pdf(完整)MySQL...
安装完毕后在cmd 里面 以 mysql -uroot -p; 登入 然后 显示可用数据库: show databases; 选择 一个数据库操作:如默认的test 或者 自己建立一个数据库 create database mydatabase; 然后在mydatabase 里制表 很...
国开作业《MySQL数据库应用》实验训练1在MySQL中创建数据库和表参考107.docx国开作业《MySQL数据库应用》实验训练1在MySQL中创建数据库和表参考107.docx国开作业《MySQL数据库应用》实验训练1在MySQL中创建数据库和...
中文mysql应用手册,里面详细讲述了mysql的操作应用。
Mysql数据库的应用
全书共分为5个部分,首先讲解了使用MySQL所需了解的数据库方面的知识,接着探讨了PHP的基本脚本语言、PHP函数以及编写可管理的简捷代码的技巧,然后给出了两个简单的应用程序,来宾簿和调查表,在实践中应用所学的...
国开《3868MySQL数据库应用-0006》期末机考学习资料.docx国开《3868MySQL数据库应用-0006》期末机考学习资料.docx国开《3868MySQL数据库应用-0006》期末机考学习资料.docx国开《3868MySQL数据库应用-0006》期末机考...
Java作业mysql应用Java作业mysql应用Java作业mysql应用Java作业mysql应用Java作业mysql应用Java作业mysql应用Java作业mysql应用Java作业mysql应用Java作业mysql应用Java作业mysql应用
实验训练1 在MySQL中创建数据库和表 实验训练2:数据查询操作 实验训练3 数据增删改操作 实验训练4:数据库系统维护
国开MySQL数据库应用形考任务1~4.doc
《PHP 5 + MYSQL 5 Web应用开发宝典》的光盘内容,缺少17章。。。
熟悉MySQL环境的使用,掌握在MySQL中创建数据库和表的方法,理解MySQL支持的数据类型、数据完整性在MySQL下的表现形式,练习MySQL数据库服务器的使用,练习CREATE TABLE,SHOW TABLES,DESCRIBE TABLE,ALTER TABLE...
《MySQL数据库原理及应用》的教案,包含所有章节。。。
MySQL数据库原理及应用(第2版)(微课版)-课外拓展.pdfMySQL数据库原理及应用(第2版)(微课版)-课外拓展.pdfMySQL数据库原理及应用(第2版)(微课版)-课外拓展.pdfMySQL数据库原理及应用(第2版)(微课版)-课外拓展....
本章通过演示如何使用mysql客户程序创造和使用一个简单的数据库,提供一个MySQL的入门教程。...mysql可以用于批模式:你预先把查询放在一个文件中,然后告诉mysql执行文件的内容。本章将介绍使用mysql的两个方法。
《MySQL数据库应用实战教程》—课程教案(教学过程设计).pdf《MySQL数据库应用实战教程》—课程教案(教学过程设计).pdf《MySQL数据库应用实战教程》—课程教案(教学过程设计).pdf《MySQL数据库应用实战教程》—课程...
MYSQL基本应用MYSQL基本应用MYSQL基本应用