Posted By

marcocs on 09/16/09


Tagged

admin Mantenimiento


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tyster


All Columns in a Table


 / Published in: SQL
 

Simple but...

  1. DECLARE @TableName sysname;
  2. SELECT @TableName = 'Users'
  3.  
  4. SELECT c.column_id ,
  5. c.name ,
  6. sys.types.name ,
  7. c.is_nullable
  8. FROM sys.COLUMNS c INNER JOIN sys.types ON c.system_type_id = sys.types.system_type_id
  9. WHERE OBJECT_NAME(c.object_id) = @TableName
  10. ORDER BY c.column_id

Report this snippet  

You need to login to post a comment.