Mega Code Archive

 
Categories / MSSQL Tutorial / System Tables Views
 

Query syscolumns

3>  CREATE TABLE customer 4> ( 5> cust_id       smallint       NOT NULL, 6> cust_name     varchar(50)    NOT NULL, 7> cust_addr1    varchar(50)    NOT NULL, 8> cust_addr2    varchar(50)    NOT NULL, 9> cust_city     varchar(50)    NOT NULL, 10> cust_state    char(2)        NOT NULL, 11> cust_zip      varchar(10)    NOT NULL, 12> cust_phone    varchar(10)    NOT NULL, 13> cust_fax      varchar(20)    NOT NULL, 14> cust_email    varchar(30)    NOT NULL, 15> cust_web_url  varchar(20)    NOT NULL 16> ) 17> GO 1> 2> SELECT colid, name, xtype, length, xusertype, offset 3> FROM syscolumns WHERE id=object_id('customer') 4> GO colid  name                                                                                                                             xtype length xusertype offset ------ -------------------------------------------------------------------------------------------------------------------------------- ----- ------ --------- ------      1 cust_id                                                                                                                             52      2        52      2      2 cust_name                                                                                                                          167     50       167     -1      3 cust_addr1                                                                                                                         167     50       167     -2      4 cust_addr2                                                                                                                         167     50       167     -3      5 cust_city                                                                                                                          167     50       167     -4      6 cust_state                                                                                                                         175      2       175      4      7 cust_zip                                                                                                                           167     10       167     -5      8 cust_phone                                                                                                                         167     10       167     -6      9 cust_fax                                                                                                                           167     20       167     -7     10 cust_email                                                                                                                         167     30       167     -8     11 cust_web_url                                                                                                                       167     20       167     -9 (11 rows affected) 1> 2> drop table customer; 3> GO 1>