emi_sastra
asked on
How to read rules created on SQL Server database from application?
Hi All,
Let's say I've created some rules inside SQL database.
Under Programmability, Rules.
I want to read it from my application to validate user input.
How could I do it?
Thank you.
Let's say I've created some rules inside SQL database.
Under Programmability, Rules.
I want to read it from my application to validate user input.
How could I do it?
Thank you.
what do you mean by "rules inside SQL database"?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Dirk,
Great. But how to query specific database ?
Thank you.
Great. But how to query specific database ?
Thank you.
sys.objects is part of each DB, and refers to its objects only. So you access it like any other table.
Qlemo is correct. If you had to run
I created the rule on a test database of mine.
When I run the following SQL:
SELECT * FROM sys.objects
in a new query window for your selected database, you will see familiar results with the objects in the selected database. Look at the fields type and type_desc to identify what it returns.I created the rule on a test database of mine.
When I run the following SQL:
SELECT *
FROM sys.objects so
JOIN sys.columns sc
ON so.object_id = sc.rule_object_id
WHERE
OBJECT_NAME(sc.object_id) = 'tblPeople' -- table name
AND sc.name = 'age' --column name
The results returned are ASKER
Hi Dirk,
Thank very much for your help.
Thank very much for your help.