0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

SQL Server に 使用されているデータ型を 一括で取得用クエリ

Last updated at Posted at 2021-03-30
sample.sql
SELECT
  c.name AS データ型
FROM dbo.syscolumns a
INNER JOIN
  dbo.sysobjects b ON a.id = b.id
INNER JOIN  dbo.systypes c ON a.xtype = c.xtype
LEFT OUTER JOIN dbo.sysindexkeys ON a.colid = dbo.sysindexkeys.colid AND a.id = dbo.sysindexkeys.id AND dbo.sysindexkeys.indid=1
LEFT OUTER JOIN dbo.syscomments ON a.cdefault = dbo.syscomments.id
INNER JOIN (
select id,name as テーブル名称 from sysobjects
where xtype='U'
 ) DT On b.name=dt.テーブル名称
where c.name<>'sysname'
group by c.name

実行結果の例
bit
datetime
int
nchar
numeric
nvarchar
varchar

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?