You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Give this a look as a SQL Server version of desc tablename in MySQL
select C.[name] as [Field]
, concat(TY.[name],
case when TY.namein ('int','bigint','smallint','tinyint','bit') then NULL
when TY.[name] in ('decimal','numeric')then concat('(',cast(C.precisionasvarchar),',',cast(C.scaleasvarchar),')')
when TY.[name] in ('money','smallmoney') then NULL
when TY.[name] in ('float') then concat('(',cast(C.precisionasvarchar),')')
when TY.[name] in ('real') then NULL
when TY.[name] in ('nchar','nvarchar') then concat('(',cast(C.max_length/2asvarchar),')')
when TY.[name] in ('char','varchar') then concat('(',cast(C.max_lengthasvarchar),')')
when TY.[name] in ('date','datetime','smalldatetime') then NULL
when TY.[name] in ('time') then concat('(',cast(C.scaleasvarchar),')')
when TY.[name] in ('datetime2','datetimeoffset') then concat('(',cast(C.scaleasvarchar),')')
when TY.[name] in ('text','ntext','image') then NULL
when TY.[name] in ('binary','varbinary') then concat('(',cast(C.max_lengthasvarchar),')')
else TY.[name]
end) as [Type]
, case when C.is_nullable=1 then 'Yes' else 'No' end as [NULL]
, case when (IC.column_idis not null) then 'PRI' else '' end as'Key'
, DC.definitionas [Default]
, case when C.is_identity=1 then 'auto_increment' end as [extra]
fromsys.tablesas T
joinsys.schemasas S onT.schema_id=S.schema_idjoinsys.columnsas C onT.object_id=C.object_idjoinsys.typesas TY onTY.user_type_id=C.user_type_idleft outer joinsys.indexes I onT.object_id=I.object_idandI.is_primary_key=1left outer joinsys.index_columns IC onI.object_id=IC.object_idandIC.OBJECT_id=T.object_idandI.index_id=IC.index_idandC.column_id=IC.column_idleft outer joinsys.default_constraintsas DC onDC.parent_object_id=T.object_idandDC.parent_column_id=C.column_idandDC.type='D'whereT.name='TABLENAME'and S.[name] ='SCHEMANAME'order byC.column_idasc;
No description provided.
The text was updated successfully, but these errors were encountered: