我现在又加上20分为别的一个问题:为什么我用update table set string_field=string_field+'my home' 这样它运行会出现这样的错误,string or binary data would be truncated
按常理这只是字符运算而以,但如果我把它改成这样string_field='test'+'ok'这样就可以,如果另外字段是int类型的它就可以这样来运算。这是为什么?
To kosisiyo:
用你这种方式会产生
Server: Msg 8118, Level 16, State 1, Line 1
Column 'test.no' is invalid in the select list because it is not contained in an aggregate function and there is no GROUP BY clause.
create table test
(No int, Date Datetime)
下面是他的记录
No Date
----------- ---------------------------
1 2000-12-31 00:00:00.000
34 1999-04-05 00:00:00.000
3 2001-09-04 00:00:00.000
3 2002-09-04 00:00:00.000
Sql语句 :
select max(date) from
(select distinct(no), date from test) t