SQL Server

SQLSERVER多表关联删除:

DELETE TABLE_A
FROM TABLE_A DD INNER JOIN TABLE_B D ON DD.DIFFER_LOG_ID = D.LOG_ID
WHERE D.UP_DATE = 20170915;

SQLSERVER多表关联修改:

UPDATE TABLE_A SET COLUMN = 'X'
FROM TABLE_A A INNER JOIN TABLE_B B ON A.COLUMN_1 = B.COLUMN_1
WHERE A.COLUMN_2 = 'Y';

SQLSERVER查询表的字段类型:

select a.name 表名,b.name 字段名,c.name 字段类型,c.length 字段长度 from sysobjects a,syscolumns b,systypes c where a.id=b.id
and a.name='TABLE_NAME' and a.xtype='U'
and b.xtype=c.xtype

posted @ 2017-09-15 13:17  Brin Page  阅读(202)  评论(0编辑  收藏  举报