exec master..sp_msforeachtable @command1='alter table ? add hit int', @whereand=' and name like ''N%'' '
这样就保险了: exec master..sp_msforeachtable @command1='alter table ? add hit int', @whereand=' and name like ''N%'' and isnumberic(right(name,len(name)-1))=1 '
上面错了. isnumberic-->isnumeric
select 'ALTER TABLE dbo.'+NAME+' ADD hit varchar(100) NULL ' AS hit, 'exec sp_addextendedproperty N''MS_Description'', N''字符串'', N''user'', N''dbo'', N''table'', N'''+name+''', N''column'', N''hit''' from dbo.sysobjects where xtype='U'
@command1='alter table ? add hit int',
@whereand=' and name like ''N%'' '
exec master..sp_msforeachtable
@command1='alter table ? add hit int',
@whereand=' and name like ''N%'' and isnumberic(right(name,len(name)-1))=1 '
isnumberic-->isnumeric
'ALTER TABLE dbo.'+NAME+' ADD hit varchar(100) NULL ' AS hit,
'exec sp_addextendedproperty N''MS_Description'', N''字符串'', N''user'', N''dbo'', N''table'', N'''+name+''', N''column'', N''hit'''
from dbo.sysobjects where xtype='U'