zoukankan
html css js c++ java
Sql Server中如何让一个表的某个字段的值连成字符串
上篇列了一个函数,功能大概是把一个字符串根据特定的分隔符号转换成表的函数
这篇我想反过来应该如何实现呢?
很多人都会想到游标循环表来达到目的,诚然这是可以达到效果的。但是可以说是最差的实现方法
那么应该如何实现呢?其实很简单,只要三句语句就可以搞定
DECLARE
@STR
VARCHAR
(
8000
)
SELECT
@STR
=
ISNULL
(
@STR
,
''
)
+
[
字段名
]
+
'
分隔符号
'
FROM
表名
SELECT
@STR
好了效果达到了。。
查看全文
相关阅读:
SQL Server 2005 中 Cross join & Cross Apply & Outer Apply 的区别
How to install Database using commandline prompt
Get SQL Server default collation
Shrink DB and Log
Visual C++ Debugging: Why does program work in debug mode, but fail in release mode?
使用Windows的SHFileOperation外壳函数实现文件操作
2 types of C++ compiler guards
LUA中的基本函数库
Ruby 数组操作方法(转)
ruby中的yield的概念
原文地址:https://www.cnblogs.com/xuanye/p/645243.html
最新文章
20080328 the difference between a Thread and a Process
20080409 ASP.NET2.0 中 Master Page 和 Content Page 事件的发生顺序
20080331 What Great .NET Developers Ought To Know Everyone who writes code
20080330 single process memory on Windows and Windows virtual memory
20080330 strongtyping and weaktyping
20080409 MySQL 主表中一列为逗号分割的子表主键的关联查询问题
20080331 What is the GAC, What problem does it solve
20080501 为 Internet Explorer 7 添加百度搜索
20080403 Microsoft.Web.Preview 中 Maximum length exceeded 问题的解决
20080409 MySQL 4.1迁移到MySQL 5.0版本的中文乱码问题解决
热门文章
20080409 .Net 2.0 的泛型小结
20080329 our dear Dr. Sara Tancredi returns
20080408 JScript 动态改变 radio input 分组的办法
20080329 一个玄妙的空格
20080331 What is a PID, How is it useful when troubleshooting a system
20080407 Javascript 刷新父窗口
20080409 unable to convert MySQL datetime value to System.DateTime
How can I monitor a given folder to see, for example, when a file was added, deleted, or modified?
C++ String: How to convert between 'CString' and 'std::string'?
Using xp_fixeddrives to Monitor Free Space
Copyright © 2011-2022 走看看