????3.????????????????
????--???????????????
????select [name] from syscolumns where
????id=object_id(N'??????') and COLUMNPROPERTY(id??name??'IsIdentity')=1
????4.???????????
????--?????????????
????exec sp_helpconstraint   '??????' ;
????5.?????????????
????--????????
exec sp_helpconstraint   '??????' ;
SELECT ???? = CASE a.colorder WHEN 1 THEN c.name ELSE '' END??
??    = a.colorder??
?????= a.name??
??? = CASE COLUMNPROPERTY(a.id??a.name??'IsIdentity') WHEN 1 THEN '√' ELSE '' END??
???? = CASE
WHEN EXISTS ( SELECT * FROM sysobjects WHERE xtype='PK'
AND name IN (SELECT [name] FROM sysindexes   WHERE id=a.id
AND indid IN (SELECT indid FROM sysindexkeys WHERE id=a.id
AND colid IN (SELECT colid FROM syscolumns   WHERE id=a.id
AND name=a.name)))) THEN '√' ELSE '' END??
????= b.name??
?????= a.length??
???? = COLUMNPROPERTY(a.id??a.name??'Precision')??
С?? = CASE ISNULL(COLUMNPROPERTY(a.id??a.name??'Scale')??0) WHEN 0 THEN '' ELSE CAST(COLUMNPROPERTY(a.id??a.name??'Scale') AS VARCHAR) END??
?????= CASE a.isnullable WHEN 1 THEN '√' ELSE '' END??
????= ISNULL(d.[text]??'')??
??? = ISNULL(e.[value]??'')
FROM syscolumns a
LEFT JOIN systypes b ON a.xtype=b.xusertype
INNER JOIN sysobjects c ON a.id=c.id AND c.xtype='U' AND c.name<>'dtproperties'
LEFT JOIN syscomments d ON a.cdefault=d.id
LEFT JOIN sys.extended_properties e ON a.id=e.class AND a.colid=e.minor_id
ORDER BY c.name?? a.colorder
????6.??????е????
????--??????????е????п???
????select * from master..sysdatabases
????7.??????????????п?????б?
????--??????????????п?????б???
use master
declare @db_name varchar(100)
declare @sql varchar(200)
declare cur_tables cursor
for
select name from sysdatabases /*where name like 'by_%'*/
open cur_tables
fetch next from cur_tables into @db_name
while @@fetch_status = 0
begin
--set @db_name = @db_name + '.dbo.sysobjects'
print @db_name
set @sql = 'select * from ' + @db_name + '.dbo.sysobjects where xtype =''U'''
exec (@sql)
fetch next from cur_tables into @db_name
end
close cur_tables
deallocate cur_tables
go