--
> ²âÊÔÊý¾Ý£º[tb]
if
object_id
(
'
[tb]
'
)
is
not
null
drop
table
[
tb
]
go
create
table
[
tb
]
(
[
id
]
int
,
[
lx
]
int
)
insert
[
tb
]
select
29
,
2
union
all
select
30
,
3
union
all
select
31
,
2
union
all
select
32
,
3
union
all
select
33
,
5
SQL 2000
select
identity
(
int
,
1
,
1
)
as
row_number,id, lx
into
#
temp
from
tb ;
select
*
from
#
temp
SQL2005+
select
row_number()
over
(
order
by
id)
as
row_number,id, lx
from
tb
±¾ÎÄ´ÓÊý¾Ý¿âÉè¼Æ¡¢¿ª·¢¡¢DBA¹ÜÀíµÈËĸö·½ÃæÐðÊöÁËSQL2005ÓëSQL2000Á½¸ö°æ±¾¼äµÄ¸Ä½ø¡£
¡¡¡¡Ò»¡¢Êý¾Ý¿âÉè¼Æ·½Ãæ
¡¡
¡¡1¡¢×Ö¶ÎÀàÐÍ¡£
¡¡¡¡varchar(max)
varchar(max)ÀàÐ͵ÄÒýÈë´ó´óµÄÌá¸ßÁ˱à³ÌµÄЧÂÊ£¬¿ÉÒÔʹÓÃ×Ö·û´®º¯Êý¶ÔCLOBÀàÐͽøÐвÙ×÷£¬ÕâÊÇÒ»¸öÁÁµã¡£µ«ÊÇÕâ¾ÍÒý·¢Á˶Ôvarchar
ºÍcharЧÂÊÌÖÂÛµÄÀÏÎÊÌâ¡£µ½µ ......