
Right click on the database diagram and new database diagram.Īdd the tables used in stored procedure to know the relationship between them.Īfter adding these two tables, it will show the foreign key relationship between the two tables.īy clicking the "Show Relationship Labels" icon In SQL Server, it will show what kind of relationship is there and what the foreign key relationship name is. It will show two table names used in this stored procedure i.e. List of tables used in a stored procedure. If we put NOCOUNT ON used in stored procedure, then after the execution of the stored procedure, the message tab in SQL Server will show the command(s) completed successfully. If we put NOCOUNT OFF used in stored procedure, then after the execution of the stored procedure the message tab in SQL Server will show (1429 row(s) affected). SQL syntax sp_helptext SP_DATABASE_DIAGRAMĮxecute the stored procedure to get the results.ĭifference between NOCOUNT ON and NOCOUNT OFF used in stored procedure. Inner join Supplier_Type_Master stm on sm.supp_type_id = stm.supp_type_idįind out the stored procedure syntax as text, using SQL query. Select sm.supplier_name, stm.supp_type from Supplier_Master Sm (100) NOT NULL,Ĭreate stored procedure using inner join between the two tables mentioned above. CHECK CONSTRAINT įinally, we create a table named Supplier_Master. WITH NOCHECK ADD CONSTRAINT FOREIGN KEY()


The foreign key is defined in a second table but it refers to the primary key in the first table.ĪLTER TABLE. The foreign key is a table that uniquely identifies a row of other table. Now, create one foreign key relationship between Supplier_master and supplier_type_master. The constraints helps for data integrity and accuracy in the table.ĪLTER TABLE. The constraints are used on a column or a table such that wrong data can't be inserted into the tables. Named DF_Supplier_Master_user_delete_flag. Step 2 CREATE SECOND TABLE NAMED Supplier_Masterīefore creating this table, I have to create a constraint. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON

List of tables used in a stored procedureĬreate a table named: Supplier_Type_Master.ĬREATE TABLE.Execute stored procedure to get results.Find out stored procedure syntax as text using SQL query.Create stored procedure using inner join between two tables.
