由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 一个sql问题:怎样实现 (((a1*10)+a2)*10+a3)*10 ...
相关主题
[合集] 又被羞辱了一把... (转载)一道面试怪题C++. (转载)
C++: friend function这个问题怎么答?
C++ namespace 弱问one question about overloading operator delete
An object of A automatically converted to an object of B.这段code有啥问题?
why use static function here?C++ func overload question
Java banned operator overloadingHow to overload global new operator?
请各位帮我看看这个最简单的Stored Procedureoperator overloading (C++)
请问一个implicit conversion的问题(C++)C++ Q89: function template and overloading (转载)
相关话题的讨论汇总
话题: select话题: version话题: 怎样话题: sql话题: 10
进入Programming版参与讨论
1 (共1页)
c*****m
发帖数: 1160
1
select value from version:
3
4
5
6
怎样从这个表里能得出“3456”这个数字?
a*****e
发帖数: 1717
2
DECLARE @a VARCHAR
SELECT @a = COALESCE(@a + '') + a FROM table order by a asc
convert to integer if you need
c*****m
发帖数: 1160
3
thanks. But that is not what I wanted.
Let me rephrase it:
怎样实现 (((a1*100)+a2)*100+a3)*100 ...
select value from version:
3
14
5
6
怎样从这个表里能得出“3140506”这个数字?
c*****m
发帖数: 1160
4
谢谢aripple。 在你的启发下,解决了:
=====
declare @aa int;
set @aa=0;
select @aa=@aa*100+dbo.ConvertStringToInt(value) from dbo.fn_Split('version
3.14.5.6', '.') order by position
select @aa
=======
好像是很基本的东西,我都忘记了。
c*****m
发帖数: 1160
5
周日上午解决一个问题,心情愉快啊。
那个表里面保存着版本的名字,比如 version 3.14.5.6, 和 version 3.2.3.4 ,我不
能用string来排序,所以先split开来,然后过滤掉非数字,cast成int (两者合并为
convertstringtoint函数),最后像上面那样累加起来,所以现在只要
order by dbo.fn_ConvertVersionToInt(versionname)就可以很好地排序了。
Now I can take a shower and start my Sunday!
c*******y
发帖数: 1630
6
better overload operator < just by if statement on tokens,
mapping to integer is slow and might overflow.
c*****m
发帖数: 1160
7

overload operator in SQL? never heard of that.

【在 c*******y 的大作中提到】
: better overload operator < just by if statement on tokens,
: mapping to integer is slow and might overflow.

c*******y
发帖数: 1630
8
混淆了你的另外一个C++问题,我以为是相关的。
c*****m
发帖数: 1160
9

那个C++的问题还没有解决呢。我怀疑跟编译器有关,不是纯c++问题。

【在 c*******y 的大作中提到】
: 混淆了你的另外一个C++问题,我以为是相关的。
c*******y
发帖数: 1630
10
很难想象编译器会这么差,99%可能是user code bug

【在 c*****m 的大作中提到】
:
: 那个C++的问题还没有解决呢。我怀疑跟编译器有关,不是纯c++问题。

1 (共1页)
进入Programming版参与讨论
相关主题
C++ Q89: function template and overloading (转载)why use static function here?
C++ function template问题Java banned operator overloading
请问关于overloading <<请各位帮我看看这个最简单的Stored Procedure
问题的根源找到了请问一个implicit conversion的问题(C++)
[合集] 又被羞辱了一把... (转载)一道面试怪题C++. (转载)
C++: friend function这个问题怎么答?
C++ namespace 弱问one question about overloading operator delete
An object of A automatically converted to an object of B.这段code有啥问题?
相关话题的讨论汇总
话题: select话题: version话题: 怎样话题: sql话题: 10