SQL 常用語法

摘要:SQL 常用語法

檢視欄位資訊 (轉至:http://www.dotblogs.com.tw/joumingt/archive/2009/07/06/9138.aspx)


SELECT         dbo.sysobjects.name AS sTableName,
                          dbo.syscolumns.name AS sColumnsName,
                          dbo.syscolumns.prec AS iColumnsLength,
                          dbo.syscolumns.colorder AS iColumnsOrder,
                          dbo.systypes.name + '' AS sColumnsType,
                          dbo.syscolumns.isnullable AS iIsNull
FROM             dbo.sysobjects INNER JOIN
                          dbo.syscolumns ON dbo.sysobjects.id = dbo.syscolumns.id INNER JOIN
                          dbo.systypes ON dbo.syscolumns.xusertype = dbo.systypes.xusertype
WHERE         (dbo.sysobjects.xtype = 'U') and   dbo.sysobjects.name = 'TABLE名稱'

 

修改欄位屬性

alter table 資料表 alter column 欄位 nvarchar(255)