Aqua Data Studio 15.0.0-dev-29
Build #: 34548
Built on: 2013-Oct-24 01:42:55 PM
O.S. : Windows 8 (64 bit)
Database : MS SQL Server 2008
1. Connect MS SQL Server Database.
2. Create Rule.
e.g.
CREATE RULE [dbo].[test_rule]
AS
@list IN ('1389', '0736', '0877');
GO
3.Right click on User Tables->Click on Create table.
4.Add name in Name text box->Add columns c1,c2 with datatypes->Select c1 Row in column panel->Click on Rule Name option in Column Properties->Select Rule from drop down list.
5. Check script in Preview SQL tab.
Script generated in Preview SQL is :
CREATE TABLE [db_accessadmin].[table_test] (
[c1] varchar(25) NOT NULL,
[c2] varchar(25) NOT NULL,
[c3] varchar(25) NOT NULL
)
GO
sp_bindrule @rulename=N'[dbo].[test_rule]', @objname=N'[db_accessadmin].[table_test].[c1]'
6.Click on Create.
7.Right click on newly created table->Script Object to Windows As->Create
Script generated in Query Analyzer is:
CREATE TABLE "db_accessadmin"."table_test" (
"c1" varchar(25) NOT NULL,
"c2" varchar(25) NOT NULL,
"c3" varchar(25) NOT NULL
)
GO
8.Right click on newly created table->Script Object to New Windows As->Create
Script generated in Query Analyzer is:
CREATE TABLE "db_accessadmin"."table_test" (
"c1" varchar(25) NOT NULL,
"c2" varchar(25) NOT NULL,
"c3" varchar(25) NOT NULL
)
ON "PRIMARY"
WITH (DATA_COMPRESSION = NONE)
GO
It will display create table script but will not display script for Rule.
@ivan: is it possible to script the sp_bindrule ?
Do we script only the SQL s and not script any stored procedures with sp ??