存储过程连接单个单元格的列值? [英] stored procedure to concatenate column value sin a single cell?

查看:65
本文介绍了存储过程连接单个单元格的列值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我想使用存储的

程序实现以下数据转换。

来源


col1 col2(varchar)

-------------------------

1 1.1

1 1.2

2 2.1

2 2.2

2 2.3
=================

所需结果


col1 col2 (varchar)

--------------------------

1 1.1 | 1.2

2 2.1 | 2.2 | 2.3

=====================

提前致谢。 :)


- Parth

Hi

I want to achieve the following transformation of data using a stored
procedure.
Source

col1 col2(varchar)
-------------------------
1 1.1
1 1.2
2 2.1
2 2.2
2 2.3
=================

Desired Result

col1 col2(varchar)
--------------------------
1 1.1 | 1.2
2 2.1 | 2.2 | 2.3
=====================
Thanks in advance. :)

- Parth

推荐答案

parth写道:
parth wrote:

我想使用存储的

程序实现以下数据转换。


来源


col1 col2(varchar)

-------------------------

1 1.1

1 1.2

2 2.1

2 2.2

2 2.3

=================

所需结果


col1 col2(varchar )

--------------------------

1 1.1 | 1.2

2 2.1 | 2.2 | 2.3

=====================
I want to achieve the following transformation of data using a stored
procedure.
Source

col1 col2(varchar)
-------------------------
1 1.1
1 1.2
2 2.1
2 2.2
2 2.3
=================

Desired Result

col1 col2(varchar)
--------------------------
1 1.1 | 1.2
2 2.1 | 2.2 | 2.3
=====================



Eww。你确定你不能在应用层做到这一点吗? (例如,
在Crystal Reports中很简单。)

Eww. Are you sure you can''t do this in the application layer? (It
would be simple in Crystal Reports, for instance.)


用于数据迁移......我必须使用存储过程

Its for data migration... i have to use stored proc


你几乎必须使用CURSOR才能实现这一点。 (虽然

你可以使用其他一些技巧,光标是你最好的选择

这里。)为了获得最佳性能,请使用FAST_FORWARD游标。


-Dave
http://www.markleconsulting.com

parth写道:
You pretty much have to use a CURSOR to make this happen. (Though
there are some other tricks you can use, a cursor is your best option
here.) For optimal performance, use a FAST_FORWARD cursor.

-Dave
http://www.markleconsulting.com
parth wrote:




我想实现以下转型数据使用存储的

程序。


来源


col1 col2(varchar)

-------------------------

1 1.1

1 1.2
2 2.1

2 2.2

2 2.3

=============== ==


所需结果


col1 col2(varchar)

--------- -----------------

1 1.1 | 1.2

2 2.1 | 2.2 | 2.3

=====================


提前致谢。 :)


- Parth
Hi

I want to achieve the following transformation of data using a stored
procedure.
Source

col1 col2(varchar)
-------------------------
1 1.1
1 1.2
2 2.1
2 2.2
2 2.3
=================

Desired Result

col1 col2(varchar)
--------------------------
1 1.1 | 1.2
2 2.1 | 2.2 | 2.3
=====================
Thanks in advance. :)

- Parth


这篇关于存储过程连接单个单元格的列值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆