SQL语句判断某个表是否存在某个字段

IF NOT EXISTS(
SELECT  *
FROM    syscolumns
WHERE   id = ( SELECT   id
               FROM     sysobjects
               WHERE    name = 'dnt_photos'
             )
        AND name = 'width')
       
ALTER TABLE [dnt_photos] ADD [width] [int] DEFAULT(0) NOT NULL  ;
posted @ 2008-07-17 11:26  戏水  阅读(4571)  评论(0编辑  收藏  举报