mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
20 lines
546 B
Transact-SQL
20 lines
546 B
Transact-SQL
-- =============================
|
|
-- Create Bound Rule template
|
|
-- =============================
|
|
-- This feature is marked for deprecation
|
|
|
|
USE <database_name, sysname, AdventureWorks>
|
|
GO
|
|
|
|
-- Define the rule for use in the database
|
|
CREATE RULE <schema_name,sysname,dbo>.<rule_name, sysname,positive_value>
|
|
AS
|
|
@value >= 0
|
|
GO
|
|
|
|
-- Bind the rule to a specific column in a table
|
|
EXEC sp_bindrule
|
|
'<schema_name,sysname,dbo>.<rule_name, sysname,positive_value>',
|
|
'<table_schema_name,,Sales>.<table_name,,SalesOrderDetail>.<column_name,,OrderQty>'
|
|
GO
|