How are constraints defined in schema? Is it by Store Procedure, User defined function or T-SQL or PL/SQL in the Database?

StackOverflow https://stackoverflow.com/questions/9324539

Question

How does SQL Server or Oracle or any database server applies constraints on the table>

I am aware of constraints, but how they are applied on the table or a column? I tried to find how SQL Server understands a requirement for a constraint and maintain the integrity.

Is there a Store Procedure or User defined function for applying a constraint? How does database server understand this scenario, when user is requested for mount a constraint on a table?

Was it helpful?

Solution

Have you looked at Microsoft's documentation page on constraints? There are many types of constraints so the DML syntax will differ for each. To your direct question no, they are not applied by using stored procs or UDF's, it's just TSQL syntax. You can also right-click on a table in SSMS and go into the designer. All constraint types can be managed their instead of raw TSQL.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top