Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
simondeutsch
Aged Yak Warrior
547 Posts |
Posted - 2011-08-01 : 11:21:28
|
I'd like to initialize some fields on a screen to the default values of a table, for example, yes/no BIT fields, or some number fields.It's possible to get a list of all DEFAULT constraints and the values querying the INFORMATION_SCHEMA.COLUMNS view, and listing all columns for TableX WHERE COLUMN_DEFAULT IS NOT NULL. However, this presents a security problem as reg users cannot get a result back from such a query - it'll be 0 rows. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-01 : 13:29:47
|
you've sys.default_constraints catalog view which gives you this information.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
simondeutsch
Aged Yak Warrior
547 Posts |
Posted - 2011-08-01 : 15:37:29
|
It's also metadata and subject to security issues. If the user has permissions on TableX, why can't the user SELECT the rows from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'TableX'?Using SQL 2005. |
 |
|
|
|
|