From: Omid Golban on
How can I display some specific defaults on some tables? For example some
tables may have a default on a CreatingUser_ID column that default the value
to suser_sid(). How could I display:
1. table name
2. column name
3. (default) constraint name
4. the default clause

Thank you,
Omid
From: TheSQLGuru on
Which version of sql server are you on?

--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net


"Omid Golban" <OmidGolban(a)discussions.microsoft.com> wrote in message
news:DDAD42EE-2E34-4C24-A12E-5389CF6B818A(a)microsoft.com...
> How can I display some specific defaults on some tables? For example some
> tables may have a default on a CreatingUser_ID column that default the
> value
> to suser_sid(). How could I display:
> 1. table name
> 2. column name
> 3. (default) constraint name
> 4. the default clause
>
> Thank you,
> Omid


From: SQL Menace on
Check out

http://wiki.lessthandot.com/index.php/How_To_Find_Out_Which_Columns_Have_Defaults_And_What_Those_Default_Values_Are


On Jul 17, 10:36 am, Omid Golban
<OmidGol...(a)discussions.microsoft.com> wrote:
> How can I display some specific defaults on some tables? For example some
> tables may have a default on a CreatingUser_ID column that default the value
> to suser_sid(). How could I display:
>    1. table name
>    2. column name
>    3. (default) constraint name
>    4. the default clause
>
> Thank you,
> Omid

From: Plamen on
Here is one way:

SELECT table_catalog,
table_schema,
table_name,
column_name,
column_default
FROM INFORMATION_SCHEMA.COLUMNS;

You can add WHERE clause to filter on table, column, etc.

HTH,

Plamen Ratchev
http://www.SQLStudio.com
From: Omid Golban on
SQL Server 2005, soon to be SQL Server 2008.
Plamen Ratchev's query gives me the answer.
I am just looking over the URL that SQL Menace posted.

Thank you all for your help.
Omid


"TheSQLGuru" wrote:

> Which version of sql server are you on?
>
> --
> Kevin G. Boles
> Indicium Resources, Inc.
> SQL Server MVP
> kgboles a earthlink dt net
>
>
> "Omid Golban" <OmidGolban(a)discussions.microsoft.com> wrote in message
> news:DDAD42EE-2E34-4C24-A12E-5389CF6B818A(a)microsoft.com...
> > How can I display some specific defaults on some tables? For example some
> > tables may have a default on a CreatingUser_ID column that default the
> > value
> > to suser_sid(). How could I display:
> > 1. table name
> > 2. column name
> > 3. (default) constraint name
> > 4. the default clause
> >
> > Thank you,
> > Omid
>
>
>