검색결과 리스트
글
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
- -- MSSQL 2005
- SELECT QUOTENAME(SCHEMA_NAME(t.schema_id))+'.'+ QUOTENAME(t.name)AS TableName
- ,c.name AS ColumnName
- ,CASE c.system_type_id
- WHEN 127 THEN 'bigint'
- WHEN 56 THEN 'int'
- WHEN 52 THEN 'smallint'
- WHEN 48 THEN 'tinyint'
- END AS'DataType'
- ,IDENT_CURRENT(SCHEMA_NAME(t.schema_id) +'.'+ t.name)AS CurrentIdentityValue
- ,CASE c.system_type_id WHEN 127 THEN 9223372036854775807
- WHEN 56 THEN 2147483647
- WHEN 52 THEN 32767
- WHEN 48 THEN 255 END - IDENT_CURRENT(SCHEMA_NAME(t.schema_id) +'.'+ t.name)AS REMIANIDENTITYVALUE
- ,CASE c.system_type_id WHEN 127 THEN 9223372036854775807
- WHEN 56 THEN 2147483647
- WHEN 52 THEN 32767
- WHEN 48 THEN 255 END AS MAXIDENTITYVALUE
- ,CASE c.system_type_id
- WHEN 127 THEN (IDENT_CURRENT(SCHEMA_NAME(t.schema_id) +'.'+ t.name)* 100.)/9223372036854775807
- WHEN 56 THEN (IDENT_CURRENT(SCHEMA_NAME(t.schema_id) +'.'+ t.name)* 100.)/2147483647
- WHEN 52 THEN (IDENT_CURRENT(SCHEMA_NAME(t.schema_id) +'.'+ t.name)* 100.)/32767
- WHEN 48 THEN (IDENT_CURRENT(SCHEMA_NAME(t.schema_id) +'.'+ t.name)* 100.)/ 255
- END AS'PercentageUsed'
- FROM sys.COLUMNSAS c INNERJOIN sys.TABLESAS t ON t.[object_id]= c.[object_id]
- WHERE c.is_identity = 1
- ORDERBY TABLENAME
- -- MSSQL 2000
- SELECT o.name AS TableName
- ,c.name AS ColumnName
- ,CASE c.type
- WHEN 127 THEN 'bigint'
- WHEN 56 THEN 'int'
- WHEN 52 THEN 'smallint'
- WHEN 48 THEN 'tinyint'
- END AS'DataType'
- ,IDENT_CURRENT(o.name)AS CurrentIdentityValue
- ,CASE c.type WHEN 127 THEN 9223372036854775807
- WHEN 56 THEN 2147483647
- WHEN 52 THEN 32767
- WHEN 48 THEN 255 END - IDENT_CURRENT(o.name)AS REMIANIDENTITYVALUE
- ,CASE c.type WHEN 127 THEN 9223372036854775807
- WHEN 56 THEN 2147483647
- WHEN 52 THEN 32767
- WHEN 48 THEN 255 END AS MAXIDENTITYVALUE
- ,CASE c.type
- WHEN 127 THEN (IDENT_CURRENT(o.name)* 100.)/ 9223372036854775807
- WHEN 56 THEN (IDENT_CURRENT(o.name)* 100.)/ 2147483647
- WHEN 52 THEN (IDENT_CURRENT(o.name)* 100.)/ 32767
- WHEN 48 THEN (IDENT_CURRENT(o.name)* 100.)/ 255
- END AS'PercentageUsed'
- FROM syscolumns c WITH(nolock)
- , sysobjects o WITH(nolock)
- WHERE c.id = o.id
- AND o.xtype ='U'
- AND COLUMNPROPERTY(o.id, c.name,'IsIdentity')= 1
- ORDERBY o.name
'-- MSSQL' 카테고리의 다른 글
MSSQL2005에서 대량데이터 Delete (0) | 2009.10.28 |
---|---|
ldf파일이 깨져 mdf만으로 db를 복구할 때 (0) | 2009.10.19 |
Some Useful Undocumented SQL Server 7.0 and 2000 DBCC Cmds (0) | 2009.09.24 |
Passing lists to SQL Server 2005 with XML Parameters (0) | 2009.09.24 |
MSSQL Server DBA 가이드 (0) | 2009.09.17 |
RECENT COMMENT