{"id":13,"date":"2008-08-29T10:52:16","date_gmt":"2008-08-29T10:52:16","guid":{"rendered":"http://divydovy.wordpress.com/?p=13"},"modified":"2020-01-23T10:30:16","modified_gmt":"2020-01-23T10:30:16","slug":"sql-server-using-parameters-and-local-variables","status":"publish","type":"post","link":"https://www.divydovy.com/2008/08/sql-server-using-parameters-and-local-variables/","title":{"rendered":"SQL Server: Using Parameters and Local Variables"},"content":{"rendered":"<p>I was trying to get a stored procedure in SQL Server to run using a mixture of parameters passed from an ASP.NET page and a local variable which I wanted to declare in order to modify one of the parameters received.</p>\n<p>I couldn&#8217;t figure out where to put the local variable in relation to the parameters, until I found this page:</p>\n<p><a title=\"SQL team article\" href=\"http://www.sqlteam.com/article/introduction-to-dynamic-sql-part-2\">http://www.sqlteam.com/article/introduction-to-dynamic-sql-part-2</a></p>\n<p>The parameters go before the &#8216;AS&#8217; statement, the local variable after, but before the &#8216;BEGIN&#8217; statement if you use it.</p>\n","protected":false},"excerpt":{"rendered":"<p>I was trying to get a stored procedure in SQL Server to run using a mixture of parameters passed from an ASP.NET page and a local variable which I wanted to declare in order to modify one of the parameters received. I couldn&#8217;t figure out where to put the local variable in relation to the parameters, until I found this page: http://www.sqlteam.com/article/introduction-to-dynamic-sql-part-2 The parameters go before the &#8216;AS&#8217; statement, the local variable after, but before the &#8216;BEGIN&#8217; statement if you use it.</p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","clkt_auto_upload":"0","_clkt_publish_and_upload":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_wordproof_timestamp":false},"categories":[293],"tags":[65,72,79,89,100],"my_content_publications":[],"class_list":["post-13","type-post","status-publish","format-standard","hentry","category-guest-posts","tag-local-variables","tag-mssql","tag-parameters","tag-resolved","tag-sql-server"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"clkt_attachments":{"featured_image":null,"inline_attachments":[],"upload_candidates":[],"max_free_size":102400,"max_allowed_size":104857600},"_clkt_upload_mode":"new_only","clkt_content_hash":"5b033a6f585337b80450868b84ddf4a3b26deec37a681496bb353b98d7b8a911","customFields":{"clkt_auto_upload":"0","activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"processed_attachments":{"total_attachments":0,"uploaded_to_arweave":0,"kept_original_urls":0,"upload_summary":{"total":0,"uploaded":0,"failed":0,"too_large":0,"reused":0}}},"paymentAddress":"8_-tV4d15kVVq9Gd-Al2MAIC3LqNtJ_KgFol71TzxPw"}