{"id":36,"date":"2018-09-26T18:16:00","date_gmt":"2018-09-26T16:16:00","guid":{"rendered":"https:\/\/kindsonthegenius.com\/blog\/2018\/09\/26\/how-to-generate-stored-procedures-automatically-using-visual-studio\/"},"modified":"2020-08-22T08:48:35","modified_gmt":"2020-08-22T06:48:35","slug":"how-to-generate-stored-procedures-automatically-using-visual-studio","status":"publish","type":"post","link":"https:\/\/kindsonthegenius.com\/blog\/how-to-generate-stored-procedures-automatically-using-visual-studio\/","title":{"rendered":"How to Generate Stored Procedures Automatically Using Visual Studio"},"content":{"rendered":"<p>You don&#8217;t have to spend your time writing stored procedures. You simply generate them. By the way writing stored procedures have always be a pain for developers and DBAs.<\/p>\n<p>So as a genius, I found an easy way you can do it!<\/p>\n<p><a href=\"https:\/\/youtu.be\/u5mu7rRdrIc\" target=\"_blank\" rel=\"noopener\">Step by Step Video explanation<\/a><br \/>\n<u><\/u><br \/>\n<b>Prerequisite<\/b><br \/>\nYou must have an existing table in MS SQL Server<\/p>\n<p>&nbsp;<\/p>\n<p><b>Step 1<\/b>: Create a Project in Visual Studio<\/p>\n<p><b>Step 2<\/b>: Right-click on the project in Solution explorer and choose Add &gt; New Item<\/p>\n<p><b>Step 3<\/b>: Choose Data in the left sided under C# and then Choose DataSet from the right<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<div style=\"clear: both; text-align: center;\"><a style=\"clear: right; margin-bottom: 1em; margin-left: 1em;\" href=\"https:\/\/2.bp.blogspot.com\/-wMyE3NvdCEI\/W6vLhkETSzI\/AAAAAAAACM8\/KBXW9_XFZwsctDst7gaBZNY0ORrxKewOQCLcBGAs\/s1600\/Step%2B3%2B-%2BChoose%2BDataset.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/2.bp.blogspot.com\/-wMyE3NvdCEI\/W6vLhkETSzI\/AAAAAAAACM8\/KBXW9_XFZwsctDst7gaBZNY0ORrxKewOQCLcBGAs\/s640\/Step%2B3%2B-%2BChoose%2BDataset.jpg\" width=\"640\" height=\"364\" border=\"0\" data-original-height=\"806\" data-original-width=\"1413\" \/><\/a><\/div>\n<p>&nbsp;<\/p>\n<p><b>Step 4<\/b>: Give the DataSet a name and Click on Add (The DataSet Designer windows opens up as shown)<\/p>\n<p><b>Step 5<\/b>: Right-click and the design surface and choose Add &gt; TableAdapter<\/p>\n<p>&nbsp;<\/p>\n<p><a style=\"clear: left; margin-bottom: 1em; margin-right: 1em;\" href=\"https:\/\/4.bp.blogspot.com\/-tAnf0yNQ9ac\/W6vLncXpVAI\/AAAAAAAACNA\/WOwzkAilKmQqX3Y3JYEIsJGSGjMaTnawACLcBGAs\/s1600\/Step%2B5%2B-%2BAdd%2BTable%2BAdapter.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter\" src=\"https:\/\/4.bp.blogspot.com\/-tAnf0yNQ9ac\/W6vLncXpVAI\/AAAAAAAACNA\/WOwzkAilKmQqX3Y3JYEIsJGSGjMaTnawACLcBGAs\/s640\/Step%2B5%2B-%2BAdd%2BTable%2BAdapter.jpg\" width=\"640\" height=\"542\" border=\"0\" data-original-height=\"853\" data-original-width=\"1004\" \/><\/a><\/p>\n<p><b>Step 6<\/b>: Create a New Connection or Select an existing one an click Next<\/p>\n<p><a style=\"-webkit-text-stroke-width: 0px; background-color: transparent; color: #0066cc; font-family: &amp;quot; font-size: 18px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-left: 18px; margin-right: 18px; orphans: 2; text-align: center; text-decoration: underline; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;\" href=\"https:\/\/2.bp.blogspot.com\/-1G92kosfJRs\/W6vLsn3PWxI\/AAAAAAAACNE\/Otv6HNed_DE8v4rEH3o6whUXgkFiEFTfwCLcBGAs\/s1600\/Step%2B6%2B-%2BChoose%2Bor%2BCreate%2BNew%2BConnection.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter\" style=\"cursor: move;\" src=\"https:\/\/2.bp.blogspot.com\/-1G92kosfJRs\/W6vLsn3PWxI\/AAAAAAAACNE\/Otv6HNed_DE8v4rEH3o6whUXgkFiEFTfwCLcBGAs\/s640\/Step%2B6%2B-%2BChoose%2Bor%2BCreate%2BNew%2BConnection.jpg\" width=\"640\" height=\"504\" border=\"0\" data-original-height=\"777\" data-original-width=\"986\" \/><\/a><b><\/b><i><\/i><u><\/u><br \/>\n<b><\/b><i><\/i><u><\/u><br \/>\n<b>Step 7<\/b>: Click Next again to display Choose Command Type window<\/p>\n<p><b>Step 8<\/b>: Choose Create New Stored Procedure and Click on Next<\/p>\n<p>&nbsp;<\/p>\n<div style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/1.bp.blogspot.com\/-qmRjH0we0RY\/W6vLxS8IQ6I\/AAAAAAAACNI\/aDDWl0Khy5oYrGqP1PYJWIkaIQg-GNubwCLcBGAs\/s1600\/Step%2B7%2B-%2BChoose%2BCommand%2BType.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/1.bp.blogspot.com\/-qmRjH0we0RY\/W6vLxS8IQ6I\/AAAAAAAACNI\/aDDWl0Khy5oYrGqP1PYJWIkaIQg-GNubwCLcBGAs\/s640\/Step%2B7%2B-%2BChoose%2BCommand%2BType.jpg\" width=\"640\" height=\"504\" border=\"0\" data-original-height=\"777\" data-original-width=\"986\" \/><\/a><\/div>\n<p>&nbsp;<\/p>\n<p><b>Step 9<\/b>: Click on Query Builder, Select the table and the close Query Builder ( you can also write the select statement yourself)<\/p>\n<p><b>Step 10<\/b>: Click on Next<\/p>\n<p><b>Step 11<\/b>: Give the stored procedure names and Click Finish.<\/p>\n<div style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/4.bp.blogspot.com\/-aerzJB7rm3c\/W6vL_k0VtLI\/AAAAAAAACNc\/wpqrZwpKos4huzvkQbYq67dQnPJEChbVQCLcBGAs\/s1600\/Step%2B11%2B-%2BGive%2BThe%2BStored%2Bprocedure%2Bnames.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/4.bp.blogspot.com\/-aerzJB7rm3c\/W6vL_k0VtLI\/AAAAAAAACNc\/wpqrZwpKos4huzvkQbYq67dQnPJEChbVQCLcBGAs\/s640\/Step%2B11%2B-%2BGive%2BThe%2BStored%2Bprocedure%2Bnames.jpg\" width=\"640\" height=\"504\" border=\"0\" data-original-height=\"777\" data-original-width=\"986\" \/><\/a><\/div>\n<p>You&#8217;re done!.<\/p>\n<p>By now, your stored procedures are beautifully created in SQL Server. You can now open SQL Server Management Studio to verify that your stored procedures have been created.<\/p>\n<div style=\"clear: both; text-align: center;\"><a style=\"clear: left; margin-bottom: 1em; margin-right: 1em;\" href=\"https:\/\/1.bp.blogspot.com\/-sXD0SKX6Qzk\/W6vL3DgjquI\/AAAAAAAACNQ\/GBYZ12J64ywyLPfSwlG--J1qWrG4CMUsQCLcBGAs\/s1600\/Step%2B9%2B-%2BSelect%2BTable.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter\" src=\"https:\/\/1.bp.blogspot.com\/-sXD0SKX6Qzk\/W6vL3DgjquI\/AAAAAAAACNQ\/GBYZ12J64ywyLPfSwlG--J1qWrG4CMUsQCLcBGAs\/s640\/Step%2B9%2B-%2BSelect%2BTable.jpg\" width=\"640\" height=\"504\" border=\"0\" data-original-height=\"777\" data-original-width=\"986\" \/><\/a><\/div>\n<p>&nbsp;<\/p>\n<div style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/1.bp.blogspot.com\/-U3OfklTg4Ho\/W6vMEVnUqrI\/AAAAAAAACNk\/DxVgAS07v1gnJYQcGeDiuVaiKtfdU416wCEwYBhgL\/s1600\/Step%2B12%2B-%2BCheck%2Bthe%2Bstored%2Bprocedures.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/1.bp.blogspot.com\/-U3OfklTg4Ho\/W6vMEVnUqrI\/AAAAAAAACNk\/DxVgAS07v1gnJYQcGeDiuVaiKtfdU416wCEwYBhgL\/s400\/Step%2B12%2B-%2BCheck%2Bthe%2Bstored%2Bprocedures.jpg\" width=\"398\" height=\"400\" border=\"0\" data-original-height=\"821\" data-original-width=\"819\" \/><\/a><\/div>\n<div style=\"clear: both; text-align: center;\"><\/div>\n<div style=\"-webkit-text-stroke-width: 0px; background-color: transparent; color: #555555; font-family: &amp;quot; font-size: 18px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: justify; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; margin: 0px;\"><a href=\"https:\/\/youtu.be\/u5mu7rRdrIc\" target=\"_blank\" rel=\"noopener\">Step by Step Video explanation<\/a><\/div>\n<div style=\"clear: both; text-align: center;\"><\/div>\n<p>So by now you have learnt how to generate stored procedure in SQL Server using Visual studio.<br \/>\nWatch the video explanation and subscribe to the free lessons.<\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/u5mu7rRdrIc\" width=\"100%\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You don&#8217;t have to spend your time writing stored procedures. You simply generate them. By the way writing stored procedures have always be a pain &hellip; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[311],"tags":[],"_links":{"self":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/36"}],"collection":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/comments?post=36"}],"version-history":[{"count":2,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/36\/revisions"}],"predecessor-version":[{"id":484,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/36\/revisions\/484"}],"wp:attachment":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/media?parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/categories?post=36"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/tags?post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}