ResultSetset=conn.prepareStatement("SELECT COL.NAME AS COLUMN_NAME, T.NAME AS COLUMN_TYPE, CAST(P.VALUE AS VARCHAR(999)) AS COLUMN_COMMENT, CASE WHEN EXISTS (SELECT 1 FROM dbo.sysindexes SI INNER JOIN dbo.sysindexkeys SIK ON SI.ID = SIK.ID AND SI.INDID = SIK.INDID INNER JOIN dbo.syscolumns SC ON SC.ID = SIK.ID AND SC.COLID = SIK.COLID INNER JOIN dbo.sysobjects SO ON SO.NAME = SI.NAME AND SO.XTYPE = 'PK' WHERE SC.ID = COL.ID AND SC.COLID = COL.COLID ) THEN 1 ELSE 0 END AS IS_PARAMY_KEY FROM syscolumns AS COL LEFT JOIN systypes T ON T.XUSERTYPE = COL.XTYPE LEFT JOIN sys.extended_properties P ON COL.ID = P.MAJOR_ID AND COL.COLID = P.MAJOR_ID WHERE COL.ID=OBJECT_ID('"+name+"')").executeQuery();
ResultSetset=conn.prepareStatement("SELECT COL.NAME AS COLUMN_NAME, T.NAME AS COLUMN_TYPE, CAST(P.VALUE AS VARCHAR(999)) AS COLUMN_COMMENT, CASE WHEN EXISTS (SELECT 1 FROM dbo.sysindexes SI INNER JOIN dbo.sysindexkeys SIK ON SI.ID = SIK.ID AND SI.INDID = SIK.INDID INNER JOIN dbo.syscolumns SC ON SC.ID = SIK.ID AND SC.COLID = SIK.COLID INNER JOIN dbo.sysobjects SO ON SO.NAME = SI.NAME AND SO.XTYPE = 'PK' WHERE SC.ID = COL.ID AND SC.COLID = COL.COLID ) THEN 1 ELSE 0 END AS IS_PARAMY_KEY FROM syscolumns AS COL LEFT JOIN systypes T ON T.XUSERTYPE = COL.XTYPE LEFT JOIN sys.extended_properties P ON COL.ID = P.MAJOR_ID AND COL.COLID = P.MAJOR_ID WHERE COL.ID=OBJECT_ID('"+name+"')").executeQuery();