{"id":569,"date":"2018-07-01T12:26:32","date_gmt":"2018-07-01T12:26:32","guid":{"rendered":"http:\/\/dbtut.com\/?p=569"},"modified":"2018-11-08T11:34:26","modified_gmt":"2018-11-08T11:34:26","slug":"cursor-usage-in-sql-server","status":"publish","type":"post","link":"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/","title":{"rendered":"Cursor Usage In SQL Server"},"content":{"rendered":"<h3><\/h3>\n<h3>WHAT IS CURSOR?<\/h3>\n<p>In SQL Server, the Cursor walks through the recordset, which is returned as a select result, to perform a transaction on each row.<\/p>\n<p>You can use it with Stored Procedure or Trigger or you can run TSQL code from within a job.<\/p>\n<p>Let&#8217;s make a simple example to understand what a cursor is and how to use it.<\/p>\n<p>Let&#8217;s write a script that sends a congratulatory mail to students who have successfully completed their education in an educational institution.<\/p>\n<p>Our student information is kept in the following table.<\/p>\n<p>Let&#8217;s send a congratulatory mail to the students who are on grade 70 or above and send an e-mail to the students who are below the score of 70 that they can not finish the course successfully.<\/p>\n<p>You need to configure Database Mail to send mail via Database Mail.<\/p>\n<p>You can benefit from the article titled &#8220;<a href=\"http:\/\/dbtut.com\/index.php\/2018\/07\/07\/how-to-configure-database-mail-on-sql-server\/\" target=\"_blank\" rel=\"noopener\">How To Configure Database Mail On SQL Server<\/a>&#8220;.<\/p>\n<h3><\/h3>\n<h3>CREATE A TABLE<\/h3>\n<pre class=\"lang:default decode:true\">CREATE TABLE [dbo].[Student](\r\n[Id] [int] IDENTITY(1,1) NOT NULL,\r\n[StudentName] [varchar](50) NULL,\r\n[StudentSurname] [varchar](50) NULL,\r\n[StudentEmail] [varchar](50) NULL,\r\n[StudentScore] [int] NULL,\r\n\u00a0CONSTRAINT [PK_Student] PRIMARY KEY CLUSTERED\r\n(\r\n[Id] ASC\r\n)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, \r\nALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]\r\n) ON [PRIMARY]<\/pre>\n<p>&nbsp;<\/p>\n<p>After creating the table, I will add 3 records to my table using the following script.<\/p>\n<p>&nbsp;<\/p>\n<h3>INSERTING RECORDS TO THE TABLE<\/h3>\n<pre class=\"lang:default decode:true\">INSERT INTO [dbo].[Student]([StudentName],[StudentSurname],[StudentEmail],[StudentScore])\r\nVALUES('Nurullah','CAKIR','nurullah.ckr@gmail.com',65)\r\n\r\nINSERT INTO [dbo].[Student]([StudentName],[StudentSurname],[StudentEmail],[StudentScore])\r\nVALUES('FARUK','ERDEM','y@gmail.com',90)\r\n\r\nINSERT INTO [dbo].[Student]([StudentName],[StudentSurname],[StudentEmail],[StudentScore])\r\nVALUES('D\u0130LARA','AYDIN',' x@gmail.com ',90)<\/pre>\n<p>&nbsp;<\/p>\n<p>Then, using the cursor, go through the records in the student table one by one and check the score when we get to each record, and if it is over 70, we will send a congratulatory mail to that student and a failure mail below 70.<\/p>\n<p>Within the code I have written explanations for easier understanding between \/ ** \/ expressions.<\/p>\n<p>&nbsp;<\/p>\n<h3>CREATING CURSOR<\/h3>\n<pre class=\"lang:default decode:true \">DECLARE @StudentName VARCHAR(50)\r\nDECLARE @StudentSurname VARCHAR(50)\r\nDECLARE @StudentEmail VARCHAR(50)\r\nDECLARE @StudentScore int\r\nDECLARE @HTML\u00a0 VARCHAR(MAX) ;\r\n\r\n\/*We give a name to Cursor*\/\r\n\r\nDECLARE CursorExample CURSOR\r\nFOR\r\n\r\n\/*The select clause that specifies the recordset that the Cursor is going to loop around.*\/\r\n\r\nSELECT [StudentName],[StudentSurname],[StudentEmail],[StudentScore] FROM [Student]\r\nOPEN CursorExample\r\nFETCH NEXT FROM CursorExample INTO @StudentName,@StudentSurname,@StudentEmail,@StudentScore\r\n\r\n\/*WHILE @@FETCH_STATUS=0\u00a0 means to move to the next record until there is no record to traverse on the Cursor.*\/\r\n\r\nWHILE @@FETCH_STATUS =0\r\nBEGIN\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\r\n\r\n\/*In the code block between \"IF (@ StudentScore&gt; = 70)\" and \"BEGIN-END\" below, \r\nif the student's grade is greater than 70, we send a congratulatory mail to that student.*\/\r\n\r\nIF(@StudentScore&gt;=70)\r\nBEGIN\r\nSET @HTML =\r\nN'&lt;H1&gt;Dear'+@StudentName+' '+@StudentSurname+',&lt;br&gt;&lt;\/H1&gt;' +\r\nN'You have successfully completed our course\r\n,&lt;br&gt;' +\r\nN'Congratulations.&lt;br&gt;'\r\n\r\nEXEC msdb.dbo.sp_send_dbmail\r\n@recipients=@StudentEmail,\r\n@subject = 'Course Success Information',\r\n@body = @HTML,\r\n@body_format = 'HTML' ;\r\nEND\r\n\r\n\/*In the code block between \"ELSE\" and \"BEGIN-END\" below, if the student's grade is less than 70, \r\nwe send a failure mail to that person*\/\r\n\r\nELSE\r\nBEGIN\r\nSET @HTML =\r\nN'&lt;H4&gt;Dear'+@StudentName+' '+@StudentSurname+',&lt;br&gt;&lt;\/H4&gt;' +\r\nN'You Could Not Complete Our Course Successfully,&lt;br&gt;' +\r\nN'You can rejoin the course.&lt;br&gt;'\r\n\r\nEXEC msdb.dbo.sp_send_dbmail\r\n@recipients=@StudentEmail,\r\n@subject = 'Course Success Information',\r\n@body = @HTML,\r\n@body_format = 'HTML' ;\r\nEND\r\n\u00a0FETCH NEXT FROM CursorExample INTO @StudentName,@StudentSurname,@StudentEmail,@StudentScore\r\nEND\r\n\r\n\/*We close the cursor with CLOSE and DEALLOCATE commands*\/\r\n\r\nCLOSE CursorExample\r\nDEALLOCATE CursorExample<\/pre>\n\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_569\" class=\"pvc_stats all  \" data-element-id=\"569\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/dbtut.com\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>WHAT IS CURSOR? In SQL Server, the Cursor walks through the recordset, which is returned as a select result, to perform a transaction on each row. You can use it with Stored Procedure or Trigger or you can run TSQL code from within a job. Let&#8217;s make a simple example to understand what a cursor &hellip;<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_569\" class=\"pvc_stats all  \" data-element-id=\"569\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/dbtut.com\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[3],"tags":[647,649,643,511,641,639,648,644,645,650,512,640,642,646],"class_list":["post-569","post","type-post","status-publish","format-standard","","category-mssql","tag-fetch_status","tag-close-cursor","tag-create-a-cursor","tag-cursor","tag-cursor-example","tag-cursor-usage","tag-deallocate-cursor","tag-declaring-cursor","tag-fetch-next","tag-msdb-dbo-sp_send_dbmail","tag-sql-server-cursor","tag-sql-server-cursor-example","tag-what-is-cursor","tag-while-fetch_status-0"],"aioseo_notices":[],"a3_pvc":{"activated":true,"total_views":430,"today_views":0},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Cursor Usage In SQL Server - Database Tutorials<\/title>\n<meta name=\"description\" content=\"Cursor Usage In SQL Server\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Cursor Usage In SQL Server - Database Tutorials\" \/>\n<meta property=\"og:description\" content=\"Cursor Usage In SQL Server\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/\" \/>\n<meta property=\"og:site_name\" content=\"Database Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2018-07-01T12:26:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-11-08T11:34:26+00:00\" \/>\n<meta name=\"author\" content=\"dbtut\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"dbtut\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/\"},\"author\":{\"name\":\"dbtut\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/person\/fc047c39e1e53dce28fc4253529ea408\"},\"headline\":\"Cursor Usage In SQL Server\",\"datePublished\":\"2018-07-01T12:26:32+00:00\",\"dateModified\":\"2018-11-08T11:34:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/\"},\"wordCount\":246,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/dbtut.com\/#organization\"},\"keywords\":[\"@@FETCH_STATUS\",\"Close Cursor\",\"create a cursor\",\"Cursor\",\"cursor example\",\"cursor usage\",\"DEALLOCATE Cursor\",\"declaring cursor\",\"FETCH NEXT\",\"msdb.dbo.sp_send_dbmail\",\"SQL Server Cursor\",\"sql server cursor example\",\"what is cursor\",\"WHILE @@FETCH_STATUS =0\"],\"articleSection\":[\"MSSQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/\",\"url\":\"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/\",\"name\":\"Cursor Usage In SQL Server - Database Tutorials\",\"isPartOf\":{\"@id\":\"https:\/\/dbtut.com\/#website\"},\"datePublished\":\"2018-07-01T12:26:32+00:00\",\"dateModified\":\"2018-11-08T11:34:26+00:00\",\"description\":\"Cursor Usage In SQL Server\",\"breadcrumb\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/dbtut.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Cursor Usage In SQL Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dbtut.com\/#website\",\"url\":\"https:\/\/dbtut.com\/\",\"name\":\"Database Tutorials\",\"description\":\"MSSQL, Oracle, PostgreSQL, MySQL, MariaDB, DB2, Sybase, Teradata, Big Data, NOSQL, MongoDB, Couchbase, Cassandra, Windows, Linux\",\"publisher\":{\"@id\":\"https:\/\/dbtut.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dbtut.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/dbtut.com\/#organization\",\"name\":\"dbtut\",\"url\":\"https:\/\/dbtut.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg\",\"contentUrl\":\"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg\",\"width\":223,\"height\":36,\"caption\":\"dbtut\"},\"image\":{\"@id\":\"https:\/\/dbtut.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/person\/fc047c39e1e53dce28fc4253529ea408\",\"name\":\"dbtut\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c322c32021bf651d9e103b183963c479a9c9791ead0715f4348203496c39aa54?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c322c32021bf651d9e103b183963c479a9c9791ead0715f4348203496c39aa54?s=96&d=mm&r=g\",\"caption\":\"dbtut\"},\"description\":\"We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.\",\"sameAs\":[\"http:\/\/NurullahCAKIR\"],\"url\":\"https:\/\/dbtut.com\/index.php\/author\/dbtut\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Cursor Usage In SQL Server - Database Tutorials","description":"Cursor Usage In SQL Server","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/","og_locale":"en_US","og_type":"article","og_title":"Cursor Usage In SQL Server - Database Tutorials","og_description":"Cursor Usage In SQL Server","og_url":"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/","og_site_name":"Database Tutorials","article_published_time":"2018-07-01T12:26:32+00:00","article_modified_time":"2018-11-08T11:34:26+00:00","author":"dbtut","twitter_card":"summary_large_image","twitter_misc":{"Written by":"dbtut","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/#article","isPartOf":{"@id":"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/"},"author":{"name":"dbtut","@id":"https:\/\/dbtut.com\/#\/schema\/person\/fc047c39e1e53dce28fc4253529ea408"},"headline":"Cursor Usage In SQL Server","datePublished":"2018-07-01T12:26:32+00:00","dateModified":"2018-11-08T11:34:26+00:00","mainEntityOfPage":{"@id":"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/"},"wordCount":246,"commentCount":0,"publisher":{"@id":"https:\/\/dbtut.com\/#organization"},"keywords":["@@FETCH_STATUS","Close Cursor","create a cursor","Cursor","cursor example","cursor usage","DEALLOCATE Cursor","declaring cursor","FETCH NEXT","msdb.dbo.sp_send_dbmail","SQL Server Cursor","sql server cursor example","what is cursor","WHILE @@FETCH_STATUS =0"],"articleSection":["MSSQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/","url":"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/","name":"Cursor Usage In SQL Server - Database Tutorials","isPartOf":{"@id":"https:\/\/dbtut.com\/#website"},"datePublished":"2018-07-01T12:26:32+00:00","dateModified":"2018-11-08T11:34:26+00:00","description":"Cursor Usage In SQL Server","breadcrumb":{"@id":"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/dbtut.com\/index.php\/2018\/07\/01\/cursor-usage-in-sql-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dbtut.com\/"},{"@type":"ListItem","position":2,"name":"Cursor Usage In SQL Server"}]},{"@type":"WebSite","@id":"https:\/\/dbtut.com\/#website","url":"https:\/\/dbtut.com\/","name":"Database Tutorials","description":"MSSQL, Oracle, PostgreSQL, MySQL, MariaDB, DB2, Sybase, Teradata, Big Data, NOSQL, MongoDB, Couchbase, Cassandra, Windows, Linux","publisher":{"@id":"https:\/\/dbtut.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dbtut.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/dbtut.com\/#organization","name":"dbtut","url":"https:\/\/dbtut.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/dbtut.com\/#\/schema\/logo\/image\/","url":"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg","contentUrl":"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg","width":223,"height":36,"caption":"dbtut"},"image":{"@id":"https:\/\/dbtut.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/dbtut.com\/#\/schema\/person\/fc047c39e1e53dce28fc4253529ea408","name":"dbtut","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/dbtut.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c322c32021bf651d9e103b183963c479a9c9791ead0715f4348203496c39aa54?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c322c32021bf651d9e103b183963c479a9c9791ead0715f4348203496c39aa54?s=96&d=mm&r=g","caption":"dbtut"},"description":"We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.","sameAs":["http:\/\/NurullahCAKIR"],"url":"https:\/\/dbtut.com\/index.php\/author\/dbtut\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/posts\/569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/comments?post=569"}],"version-history":[{"count":0,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/posts\/569\/revisions"}],"wp:attachment":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/media?parent=569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/categories?post=569"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/tags?post=569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}