SQL Server Performance

Query

Discussion in 'Getting Started' started by RVG, Jan 28, 2010.

  1. RVG Member

    Hi,
    I have a doubt regarding datatype. I have a employee table where it has attributes like, emp id int, salary money, name varchar(10). I want to know the data types as my query result of my table.Is there any way I can get the datatpe result using "select" command?
    Thanks & Regards,
    Ravi
  2. patel_mayur New Member

    select
    a.[Name], b.name, a.max_lengthfrom
    sys.columns ajoin
    sys.types bon
    a.user_type_id = b.user_type_idwhere
    [object_id] = object_id('your_table_name')order
    by column_id
  3. preethi Member

    An alternate option is to query from INFORMATION_SCHEMA.Columns. You can filter by TABLE_SCHEMA and TABLE_NAME
    You can also use sp_Help <table name>
  4. Madhivanan Moderator

    or
    exec sp_columns 'table name'
  5. FrankKalis Moderator

    Unless you are querying through some weird abstraction layer or some fancy querying tool, the data types in your result set will be the same as defined in the base tables. Of course, only if you don't do any conversion in your query... [:)]

Share This Page