Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2003
    Posts
    176

    Unanswered: defaults in the DB

    How do i know whats the default values on which table and which column and whats the default value

    It should be like this

    Table column constraint_name value

    emp emp_id DF_emp_emp_no 1
    emp join_date DF_emp_cur_date getdate()

    How can i get these results on all the tables in my DB.

    Thanks.

  2. #2
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040
    sp_help '<table_name>'

    After the column list of index(es), the proc will list any constraints by column name.

  3. #3
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Code:
    select
    Code:
    object_name(c.id)+'.'+col_name(c.id, c.colid)+' - '+
       object_name(c.constid)+' value: '+text
       from sysconstraints c
       inner join syscomments sc on c.constid = sc.id
       where(c.status & 5)= 5
       and objectproperty(c.id,'IsMSShipped')= 0
       order by object_name(c.id)

    Last edited by rdjabarov; 10-07-04 at 16:53.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Buy that man a drink!
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •