首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

请帮忙解决以下更新有关问题!偶想了三天半没解决

2012-01-12 
请帮忙解决以下更新问题!!!偶想了三天半没解决~zd1CCC如果要在zd1后面加上数字,要怎么写语句?(C1,C2,C3...

请帮忙解决以下更新问题!!!偶想了三天半没解决~

                                                    zd1

                                                      C

                                                      C

                                                      C

如果要在zd1后面加上数字,要怎么写语句?(C1,C2,C3...C12,c13...c20,c21)

请注释以下语句的意思:(有能修复表   'sysindexes '一致性错误的语句吗?)
exec   sp_msforeachtable   'DBCC   CHECKTABLE( ' '? ' ',REPAIR_REBUILD) '      
exec   sp_msforeachtable   'DBCC   DBREINDEX( ' '? ' ') '

[解决办法]
select id=identity(int,1,1) , * into test from tb

select zd1 + cast(id as varchar) from test
[解决办法]
declare @t table(CODE varchar(8))
insert into @t select 'C '
insert into @t select 'C '
insert into @t select 'C '
insert into @t select 'C '
insert into @t select 'C '
insert into @t select 'C '
insert into @t select 'C '
insert into @t select 'C '

declare @i int
set @i=0

update @t set @i=@i+1,CODE=CODE+rtrim(@i)

select * from @t

/*
CODE
--------
C1
C2
C3
C4
C5
C6
C7
C8
*/

热点排行
Bad Request.