{"id":2209,"date":"2017-02-28T12:53:20","date_gmt":"2017-02-28T11:53:20","guid":{"rendered":"http:\/\/monodes.com\/predaelli\/?p=2209"},"modified":"2017-02-28T12:53:20","modified_gmt":"2017-02-28T11:53:20","slug":"how-to-backup-sql-server-to-sql-file-stack-overflow","status":"publish","type":"post","link":"https:\/\/monodes.com\/predaelli\/2017\/02\/28\/how-to-backup-sql-server-to-sql-file-stack-overflow\/","title":{"rendered":"How to backup Sql Server to sql file? &#8211; Stack Overflow"},"content":{"rendered":"<blockquote><p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2181\" data-permalink=\"https:\/\/monodes.com\/predaelli\/2017\/02\/20\/wordpress-difference-between-wp_site_url-and-wp_home-stack-overflow\/apple-touch-icon2-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2017\/02\/apple-touch-icon%402.png?fit=316%2C316&amp;ssl=1\" data-orig-size=\"316,316\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"apple-touch-icon@2\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2017\/02\/apple-touch-icon%402.png?fit=316%2C316&amp;ssl=1\" class=\"alignright size-thumbnail wp-image-2181\" src=\"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2017\/02\/apple-touch-icon%402-150x150-1.png?resize=150%2C150\" alt=\"apple-touch-icon@2\" width=\"150\" height=\"150\" \/>In &#8220;Back UP&#8221; I only get a bak file, but I would like to create .sql file<\/p><\/blockquote>\n<p>Sorgente: <em><a href=\"http:\/\/stackoverflow.com\/questions\/5212580\/how-to-backup-sql-server-to-sql-file\">How to backup Sql Server to sql file? &#8211; Stack Overflow<\/a><\/em><\/p>\n<p>I may need it pretty soon<\/p>\n<p><!--more--><\/p>\n<blockquote>\n<div id=\"answer-6782725\" class=\"answer\" data-answerid=\"6782725\">\n<table>\n<tbody>\n<tr>\n<td class=\"votecell\">\n<div class=\"vote\"><a class=\"vote-up-off\" title=\"This answer is useful\">up vote<\/a> <span class=\"vote-count-post \">25<\/span> <a class=\"vote-down-off\" title=\"This answer is not useful\">down vote<\/a><\/div>\n<\/td>\n<td class=\"answercell\">\n<div class=\"post-text\">\n<p>Use SQL Server&#8217;s Generate Scripts commend<\/p>\n<ul>\n<li>right click on the database; Tasks -&gt; Generate Scripts<\/li>\n<li>select your tables, click Next<\/li>\n<li>click the Advanced button<\/li>\n<li>find Types of data to script &#8211; choose <strong>Schema and Data<\/strong>.<\/li>\n<li>you can then choose to save to file, or put in new query window.<\/li>\n<li>results in <code class=\"\" data-line=\"\">CREATE<\/code> and <code class=\"\" data-line=\"\">INSERT<\/code> statements for all table data selected in bullet 2.<\/li>\n<\/ul>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/5212580\/how-to-backup-sql-server-to-sql-file\"><img data-recalc-dims=\"1\" decoding=\"async\" class=\"alignnone size-full\" src=\"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2017\/02\/58CwU.png?w=910\" alt=\"\" \/><\/a><\/p>\n<\/div>\n<table class=\"fw\">\n<tbody>\n<tr>\n<td class=\"vt\">\n<div class=\"post-menu\"><a id=\"link-post-6782725\" class=\"short-link\" title=\"short permalink to this answer\" href=\"http:\/\/stackoverflow.com\/a\/6782725\">share<\/a><a class=\"suggest-edit-post\" title=\"\" href=\"http:\/\/stackoverflow.com\/posts\/6782725\/edit\">improve this answer<\/a><\/div>\n<\/td>\n<td class=\"post-signature\" align=\"right\">\n<div class=\"user-info user-hover\">\n<div class=\"user-action-time\">answered <span class=\"relativetime\" title=\"2011-07-21 21:00:10Z\">Jul 21 &#8217;11 at 21:00<\/span><\/div>\n<div class=\"user-gravatar32\">\n<div class=\"gravatar-wrapper-32\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2017\/02\/U5Ece.jpg?resize=32%2C32\" alt=\"\" width=\"32\" height=\"32\" \/><\/div>\n<\/div>\n<div class=\"user-details\"><a href=\"http:\/\/stackoverflow.com\/users\/23199\/p-campbell\">p.campbell<\/a><\/p>\n<div class=\"-flair\"><span class=\"reputation-score\" dir=\"ltr\" title=\"reputation score 58,422\">58.4k<\/span><span title=\"51 gold badges\"><span class=\"badgecount\">51<\/span><\/span><span title=\"194 silver badges\"><span class=\"badgecount\">194<\/span><\/span><span title=\"278 bronze badges\"><span class=\"badgecount\">278<\/span><\/span><\/div>\n<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"votecell\"><\/td>\n<td>\n<div id=\"comments-link-6782725\" data-rep=\"50\" data-anon=\"true\"><a class=\"js-add-link comments-link disabled-link \" title=\"Use comments to ask for more information or suggest improvements. Avoid comments like \u201c+1\u201d or \u201cthanks\u201d.\">add a comment<\/a><\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div id=\"clc-mlb\" class=\"everyonelovesstackoverflow adzerk-vote\"><a title=\"\" href=\"http:\/\/engine.adzerk.net\/r?e=eyJhdiI6NDE0LCJhdCI6NCwiYnQiOjAsImNtIjo1MTc3NTcsImNoIjoxMTc4LCJjayI6e30sImNyIjoxNjM4OTgyLCJkaSI6IjA0NzgwY2UyMGRjMjQxNmI5NTI1NGRkOGNlNzJjZDQwIiwiZG0iOjEsImZjIjoyMTY0NDk0LCJmbCI6MjYzMTUxNCwiaXAiOiI3OS41MC4xMzAuNCIsImt3Ijoic3FsLHNxbC1zZXJ2ZXIsZGF0YWJhc2UsYmFja3VwLHgtY3Jvc3Mtc2l0ZS1zZXJ2ZXJmYXVsdC5jb20iLCJtayI6IngtY3Jvc3Mtc2l0ZS1zZXJ2ZXJmYXVsdC5jb20iLCJudyI6MjIsInBjIjowLCJlYyI6MCwicHIiOjE2MDQsInJ0IjoyLCJyZiI6Imh0dHBzOi8vd3d3Lmdvb2dsZS5pdC8iLCJzdCI6ODI3NywidWsiOiJ1ZTEtYTBhZGNiNmVlOWMwNDA5N2I2MjkyMjE2NDI2MGNhODAiLCJ6biI6NDQsInRzIjoxNDg4MjgyNjI2OTgyLCJiZiI6dHJ1ZSwicG4iOiJjbGMtbWxiIiwidXIiOiJodHRwOi8vc3RhY2tvdmVyZmxvdy5jb20vam9icz91dG1fc291cmNlPXdlYnNpdGUmdXRtX21lZGl1bT1iYW5uZXImdXRtX2NvbnRlbnQ9bGVhZGVyYm9hcmRfNiZ1dG1fY2FtcGFpZ249aG91c2VfYWRzX2hvdXNlX2Fkc19ST1NfU08ifQ&amp;s=Qpymz6iUB7eUYh3SUiqo8VKbNlw\" target=\"_blank\" rel=\"nofollow\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" title=\"\" src=\"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2017\/02\/6659d543875d40bfb2e08cde06af5a6f.png?resize=728%2C90\" alt=\"\" width=\"728\" height=\"90\" border=\"0\" \/><\/a><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/engine.adzerk.net\/i.gif?w=910\" alt=\"\"   border=\"0\" \/><\/div>\n<p><a name=\"5214273\"><\/a><\/p>\n<div id=\"answer-5214273\" class=\"answer\" data-answerid=\"5214273\">\n<table>\n<tbody>\n<tr>\n<td class=\"votecell\">\n<div class=\"vote\"><a class=\"vote-up-off\" title=\"This answer is useful\">up vote<\/a> <span class=\"vote-count-post \">4<\/span> <a class=\"vote-down-off\" title=\"This answer is not useful\">down vote<\/a><\/div>\n<\/td>\n<td class=\"answercell\">\n<div class=\"post-text\">\n<p>This is a possible duplicate of: <a href=\"http:\/\/stackoverflow.com\/questions\/5078587\/sql-script-to-get-table-content-as-select-from-tblname\">SQL script to get table content as &#8220;SELECT * FROM tblname&#8221;<\/a><\/p>\n<p>To do a full database backup to File\/Query you can use the &#8216;Generate Scripts&#8230;&#8217; option on the Database.<\/p>\n<p>Open SQL Server Management studio, right click on the database and choose &#8216;Tasks-&gt;Generate Scripts&#8230;&#8217;<\/p>\n<p>Then use the wizard to backup the database. You can script the whole database or parts of it. Two important options: In the &#8216;Advanced&#8217; section, you will probably want to ensure &#8216;Type of backup = &#8216;Schema and Data&#8217; and the &#8216;Script Statistics&#8217; is on.<\/p>\n<p>This will produce a *.sql file that you can use as a backup that includes the schema and table data.<\/p>\n<\/div>\n<table class=\"fw\">\n<tbody>\n<tr>\n<td class=\"vt\">\n<div class=\"post-menu\"><a id=\"link-post-5214273\" class=\"short-link\" title=\"short permalink to this answer\" href=\"http:\/\/stackoverflow.com\/a\/5214273\">share<\/a><a class=\"suggest-edit-post\" title=\"\" href=\"http:\/\/stackoverflow.com\/posts\/5214273\/edit\">improve this answer<\/a><\/div>\n<\/td>\n<td class=\"post-signature\" align=\"right\">\n<div class=\"user-info user-hover\">\n<div class=\"user-action-time\">answered <span class=\"relativetime\" title=\"2011-03-06 23:34:22Z\">Mar 6 &#8217;11 at 23:34<\/span><\/div>\n<div class=\"user-gravatar32\">\n<div class=\"gravatar-wrapper-32\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gravatar.com\/avatar\/6bd50c6e3a3772e1162a06e99abfac9d?s=32&amp;d=identicon&amp;r=PG\" alt=\"\" width=\"32\" height=\"32\" \/><\/div>\n<\/div>\n<div class=\"user-details\"><a href=\"http:\/\/stackoverflow.com\/users\/355657\/simon\">Simon<\/a><\/p>\n<div class=\"-flair\"><span class=\"reputation-score\" dir=\"ltr\" title=\"reputation score \">5,082<\/span><span title=\"8 gold badges\"><span class=\"badgecount\">8<\/span><\/span><span title=\"41 silver badges\"><span class=\"badgecount\">41<\/span><\/span><span title=\"92 bronze badges\"><span class=\"badgecount\">92<\/span><\/span><\/div>\n<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"votecell\"><\/td>\n<td>\n<div id=\"comments-5214273\" class=\"comments \">\n<table>\n<tbody data-remaining-comments-count=\"0\" data-canpost=\"false\" data-cansee=\"true\" data-comments-unavailable=\"false\" data-addlink-disabled=\"true\">\n<tr id=\"comment-5971523\" class=\"comment \">\n<td class=\"comment-actions\">\n<table>\n<tbody>\n<tr>\n<td class=\" comment-score\"><span class=\"cool\" title=\"number of 'useful comment' votes received\">1<\/span><\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<td class=\"comment-text\">\n<div class=\"comment-body\"><span class=\"comment-copy\">it does not generate inserts \ud83d\ude41<\/span> \u2013\u00a0<a class=\"comment-user owner\" title=\"25,276 reputation\" href=\"http:\/\/stackoverflow.com\/users\/30453\/iadapter\">IAdapter<\/a> <span class=\"comment-date\" dir=\"ltr\"><a class=\"comment-link\" href=\"http:\/\/stackoverflow.com\/questions\/5212580\/how-to-backup-sql-server-to-sql-file#comment5971523_5214273\"><span class=\"relativetime-clean\" title=\"2011-03-14 08:16:44Z\">Mar 14 &#8217;11 at 8:16<\/span><\/a><\/span><\/div>\n<\/td>\n<\/tr>\n<tr id=\"comment-5985842\" class=\"comment \">\n<td class=\"comment-actions\">\n<table>\n<tbody>\n<tr>\n<td class=\" comment-score\"><span class=\"cool\" title=\"number of 'useful comment' votes received\">4<\/span><\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<td class=\"comment-text\">\n<div class=\"comment-body\"><span class=\"comment-copy\">You need to ensure that &#8216;Type of Backup = Schema and Data&#8217;. It definately generates INSERT statements when you have selected this also.<\/span> \u2013\u00a0<a class=\"comment-user\" title=\"5,082 reputation\" href=\"http:\/\/stackoverflow.com\/users\/355657\/simon\">Simon<\/a> <span class=\"comment-date\" dir=\"ltr\"><a class=\"comment-link\" href=\"http:\/\/stackoverflow.com\/questions\/5212580\/how-to-backup-sql-server-to-sql-file#comment5985842_5214273\"><span class=\"relativetime-clean\" title=\"2011-03-15 03:07:11Z\">Mar 15 &#8217;11 at 3:07<\/span><\/a><\/span><\/div>\n<\/td>\n<\/tr>\n<tr id=\"comment-21021243\" class=\"comment \">\n<td class=\"comment-actions\">\n<table>\n<tbody>\n<tr>\n<td class=\" comment-score\"><span class=\"cool\" title=\"number of 'useful comment' votes received\">1<\/span><\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<td class=\"comment-text\">\n<div class=\"comment-body\"><span class=\"comment-copy\">Specifically while on the &#8220;Set Scripting Options&#8221; step of the wizard you need to click &#8220;Advanced&#8221; to the right of the &#8220;Save to file&#8221;. Then under &#8220;Types of data to script&#8221; choose &#8220;Schema and data&#8221;<\/span> \u2013\u00a0<a class=\"comment-user\" title=\"1,374 reputation\" href=\"http:\/\/stackoverflow.com\/users\/175830\/jason-axelson\">Jason Axelson<\/a> <span class=\"comment-date\" dir=\"ltr\"><a class=\"comment-link\" href=\"http:\/\/stackoverflow.com\/questions\/5212580\/how-to-backup-sql-server-to-sql-file#comment21021243_5214273\"><span class=\"relativetime-clean\" title=\"2013-02-20 02:42:23Z\">Feb 20 &#8217;13 at 2:42<\/span><\/a><\/span><\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div id=\"comments-link-5214273\" data-rep=\"50\" data-anon=\"true\"><a class=\"js-add-link comments-link disabled-link \" title=\"Use comments to ask for more information or suggest improvements. Avoid comments like \u201c+1\u201d or \u201cthanks\u201d.\">add a comment<\/a><\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><a name=\"17091242\"><\/a><\/p>\n<div id=\"answer-17091242\" class=\"answer\" data-answerid=\"17091242\">\n<table>\n<tbody>\n<tr>\n<td class=\"votecell\">\n<div class=\"vote\"><a class=\"vote-up-off\" title=\"This answer is useful\">up vote<\/a> <span class=\"vote-count-post \">3<\/span> <a class=\"vote-down-off\" title=\"This answer is not useful\">down vote<\/a><\/div>\n<\/td>\n<td class=\"answercell\">\n<div class=\"post-text\">\n<p>Ok, I read through most of these, but I had no &#8220;advanced button&#8221;. But, there is still a way to do it, it&#8217;s just a little hard to find, so here you go:<\/p>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/5212580\/how-to-backup-sql-server-to-sql-file\"><img data-recalc-dims=\"1\" decoding=\"async\" class=\"alignnone size-full\" src=\"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2017\/02\/lqH1q.png?w=910\" alt=\"\" \/><\/a><\/p>\n<\/div>\n<table class=\"fw\">\n<tbody>\n<tr>\n<td class=\"vt\">\n<div class=\"post-menu\"><a id=\"link-post-17091242\" class=\"short-link\" title=\"short permalink to this answer\" href=\"http:\/\/stackoverflow.com\/a\/17091242\">share<\/a><a class=\"suggest-edit-post\" title=\"\" href=\"http:\/\/stackoverflow.com\/posts\/17091242\/edit\">improve this answer<\/a><\/div>\n<\/td>\n<td class=\"post-signature\" align=\"right\">\n<div class=\"user-info user-hover\">\n<div class=\"user-action-time\">answered <span class=\"relativetime\" title=\"2013-06-13 15:38:14Z\">Jun 13 &#8217;13 at 15:38<\/span><\/div>\n<div class=\"user-gravatar32\">\n<div class=\"gravatar-wrapper-32\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2017\/02\/7bA0M.jpg?resize=32%2C32\" alt=\"\" width=\"32\" height=\"32\" \/><\/div>\n<\/div>\n<div class=\"user-details\"><a href=\"http:\/\/stackoverflow.com\/users\/1152809\/travis-heeter\">Travis Heeter<\/a><\/p>\n<div class=\"-flair\"><span class=\"reputation-score\" dir=\"ltr\" title=\"reputation score \">1,990<\/span><span title=\"17 silver badges\"><span class=\"badgecount\">17<\/span><\/span><span title=\"43 bronze badges\"><span class=\"badgecount\">43<\/span><\/span><\/div>\n<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"votecell\"><\/td>\n<td>\n<div id=\"comments-link-17091242\" data-rep=\"50\" data-anon=\"true\"><a class=\"js-add-link comments-link disabled-link \" title=\"Use comments to ask for more information or suggest improvements. Avoid comments like \u201c+1\u201d or \u201cthanks\u201d.\">add a comment<\/a><\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><a name=\"5212613\"><\/a><\/p>\n<div id=\"answer-5212613\" class=\"answer\" data-answerid=\"5212613\">\n<table>\n<tbody>\n<tr>\n<td class=\"votecell\">\n<div class=\"vote\"><a class=\"vote-up-off\" title=\"This answer is useful\">up vote<\/a> <span class=\"vote-count-post \">2<\/span> <a class=\"vote-down-off\" title=\"This answer is not useful\">down vote<\/a><\/div>\n<\/td>\n<td class=\"answercell\">\n<div class=\"post-text\">\n<p>You can generate a script from a database, see <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms178078.aspx\" rel=\"nofollow\">http:\/\/msdn.microsoft.com\/en-us\/library\/ms178078.aspx<\/a><\/p>\n<\/div>\n<table class=\"fw\">\n<tbody>\n<tr>\n<td class=\"vt\">\n<div class=\"post-menu\"><a id=\"link-post-5212613\" class=\"short-link\" title=\"short permalink to this answer\" href=\"http:\/\/stackoverflow.com\/a\/5212613\">share<\/a><a class=\"suggest-edit-post\" title=\"\" href=\"http:\/\/stackoverflow.com\/posts\/5212613\/edit\">improve this answer<\/a><\/div>\n<\/td>\n<td class=\"post-signature\" align=\"right\">\n<div class=\"user-info \">\n<div class=\"user-action-time\">answered <span class=\"relativetime\" title=\"2011-03-06 18:47:46Z\">Mar 6 &#8217;11 at 18:47<\/span><\/div>\n<div class=\"user-gravatar32\">\n<div class=\"gravatar-wrapper-32\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gravatar.com\/avatar\/0626b05fdc3651c59193e1f33c39bbf5?s=32&amp;d=identicon&amp;r=PG\" alt=\"\" width=\"32\" height=\"32\" \/><\/div>\n<\/div>\n<div class=\"user-details\"><a href=\"http:\/\/stackoverflow.com\/users\/642774\/cusimar9\">cusimar9<\/a><\/p>\n<div class=\"-flair\"><span class=\"reputation-score\" dir=\"ltr\" title=\"reputation score \">3,292<\/span><span title=\"1 gold badge\"><span class=\"badgecount\">1<\/span><\/span><span title=\"14 silver badges\"><span class=\"badgecount\">14<\/span><\/span><span title=\"29 bronze badges\"><span class=\"badgecount\">29<\/span><\/span><\/div>\n<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"votecell\"><\/td>\n<td>\n<div id=\"comments-5212613\" class=\"comments \">\n<table>\n<tbody data-remaining-comments-count=\"0\" data-canpost=\"false\" data-cansee=\"true\" data-comments-unavailable=\"false\" data-addlink-disabled=\"true\">\n<tr id=\"comment-5971518\" class=\"comment \">\n<td>\n<table>\n<tbody>\n<tr>\n<td class=\" comment-score\"><\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<td class=\"comment-text\">\n<div class=\"comment-body\"><span class=\"comment-copy\">it does not generate inserts \ud83d\ude41<\/span> \u2013\u00a0<a class=\"comment-user owner\" title=\"25,276 reputation\" href=\"http:\/\/stackoverflow.com\/users\/30453\/iadapter\">IAdapter<\/a> <span class=\"comment-date\" dir=\"ltr\"><a class=\"comment-link\" href=\"http:\/\/stackoverflow.com\/questions\/5212580\/how-to-backup-sql-server-to-sql-file#comment5971518_5212613\"><span class=\"relativetime-clean\" title=\"2011-03-14 08:16:08Z\">Mar 14 &#8217;11 at 8:16<\/span><\/a><\/span><\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div id=\"comments-link-5212613\" data-rep=\"50\" data-anon=\"true\"><a class=\"js-add-link comments-link disabled-link \" title=\"Use comments to ask for more information or suggest improvements. Avoid comments like \u201c+1\u201d or \u201cthanks\u201d.\">add a comment<\/a><\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><a name=\"5212615\"><\/a><\/p>\n<div id=\"answer-5212615\" class=\"answer\" data-answerid=\"5212615\">\n<table>\n<tbody>\n<tr>\n<td class=\"votecell\">\n<div class=\"vote\"><a class=\"vote-up-off\" title=\"This answer is useful\">up vote<\/a> <span class=\"vote-count-post \">0<\/span> <a class=\"vote-down-off\" title=\"This answer is not useful\">down vote<\/a><\/div>\n<\/td>\n<td class=\"answercell\">\n<div class=\"post-text\">\n<p>If you want to create a script of your database you right-click on the databases and Generate Scripts (it&#8217;s in different sub-menus depending on what version of SQL and Enterprise Manager \/ SQL Server Management studio you&#8217;re using).<\/p>\n<p>That will, however, only get you the database objects. It will not generate scripts for data. Backing up a database will give you all of the database objects as well as the data, depending on what recovery model your database is set to.<\/p>\n<\/div>\n<table class=\"fw\">\n<tbody>\n<tr>\n<td class=\"vt\">\n<div class=\"post-menu\"><a id=\"link-post-5212615\" class=\"short-link\" title=\"short permalink to this answer\" href=\"http:\/\/stackoverflow.com\/a\/5212615\">share<\/a><a class=\"suggest-edit-post\" title=\"\" href=\"http:\/\/stackoverflow.com\/posts\/5212615\/edit\">improve this answer<\/a><\/div>\n<\/td>\n<td class=\"post-signature\" align=\"right\">\n<div class=\"user-info user-hover\">\n<div class=\"user-action-time\">answered <span class=\"relativetime\" title=\"2011-03-06 18:48:06Z\">Mar 6 &#8217;11 at 18:48<\/span><\/div>\n<div class=\"user-gravatar32\">\n<div class=\"gravatar-wrapper-32\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gravatar.com\/avatar\/fe6c5931802371700bddfa845f8a4d86?s=32&amp;d=identicon&amp;r=PG\" alt=\"\" width=\"32\" height=\"32\" \/><\/div>\n<\/div>\n<div class=\"user-details\"><a href=\"http:\/\/stackoverflow.com\/users\/75852\/squillman\">squillman<\/a><\/p>\n<div class=\"-flair\"><span class=\"reputation-score\" dir=\"ltr\" title=\"reputation score \">6,921<\/span><span title=\"3 gold badges\"><span class=\"badgecount\">3<\/span><\/span><span title=\"19 silver badges\"><span class=\"badgecount\">19<\/span><\/span><span title=\"45 bronze badges\"><span class=\"badgecount\">45<\/span><\/span><\/div>\n<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"votecell\"><\/td>\n<td>\n<div id=\"comments-link-5212615\" data-rep=\"50\" data-anon=\"true\"><a class=\"js-add-link comments-link disabled-link \" title=\"Use comments to ask for more information or suggest improvements. Avoid comments like \u201c+1\u201d or \u201cthanks\u201d.\">add a comment<\/a><\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><a name=\"5212619\"><\/a><\/p>\n<div id=\"answer-5212619\" class=\"answer\" data-answerid=\"5212619\">\n<table>\n<tbody>\n<tr>\n<td class=\"votecell\">\n<div class=\"vote\"><a class=\"vote-up-off\" title=\"This answer is useful\">up vote<\/a> <span class=\"vote-count-post \">0<\/span> <a class=\"vote-down-off\" title=\"This answer is not useful\">down vote<\/a><\/div>\n<\/td>\n<td class=\"answercell\">\n<div class=\"post-text\">\n<p><a href=\"http:\/\/social.msdn.microsoft.com\/Forums\/en-US\/sqlexpress\/thread\/a67cb89c-0578-4896-a418-977739299296\/\" rel=\"nofollow\">This fellow<\/a> may have achieved what you are trying to do by <strong>creating the backup, and then restoring it and giving it a new name.<\/strong><\/p>\n<p>This approach copies the data along with all of the database objects.<\/p>\n<\/div>\n<table class=\"fw\">\n<tbody>\n<tr>\n<td class=\"vt\">\n<div class=\"post-menu\"><a id=\"link-post-5212619\" class=\"short-link\" title=\"short permalink to this answer\" href=\"http:\/\/stackoverflow.com\/a\/5212619\">share<\/a><a class=\"suggest-edit-post\" title=\"\" href=\"http:\/\/stackoverflow.com\/posts\/5212619\/edit\">improve this answer<\/a><\/div>\n<\/td>\n<td class=\"post-signature\" align=\"right\">\n<div class=\"user-info \">\n<div class=\"user-action-time\"><a title=\"show all edits to this post\" href=\"http:\/\/stackoverflow.com\/posts\/5212619\/revisions\">edited <span class=\"relativetime\" title=\"2011-03-06 18:54:00Z\">Mar 6 &#8217;11 at 18:54<\/span><\/a><\/div>\n<div class=\"user-gravatar32\"><\/div>\n<div class=\"user-details\"><\/div>\n<\/div>\n<\/td>\n<td class=\"post-signature\" align=\"right\">\n<div class=\"user-info user-hover\">\n<div class=\"user-action-time\">answered <span class=\"relativetime\" title=\"2011-03-06 18:48:59Z\">Mar 6 &#8217;11 at 18:48<\/span><\/div>\n<div class=\"user-gravatar32\">\n<div class=\"gravatar-wrapper-32\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.gravatar.com\/avatar\/a76f3b842f71f786d036062e8711ee13?s=32&amp;d=identicon&amp;r=PG\" alt=\"\" width=\"32\" height=\"32\" \/><\/div>\n<\/div>\n<div class=\"user-details\"><a href=\"http:\/\/stackoverflow.com\/users\/27637\/dok\">DOK<\/a><\/p>\n<div class=\"-flair\"><span class=\"reputation-score\" dir=\"ltr\" title=\"reputation score 25,491\">25.5k<\/span><span title=\"6 gold badges\"><span class=\"badgecount\">6<\/span><\/span><span title=\"47 silver badges\"><span class=\"badgecount\">47<\/span><\/span><span title=\"83 bronze badges\"><span class=\"badgecount\">83<\/span><\/span><\/div>\n<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"votecell\"><\/td>\n<td>\n<div id=\"comments-link-5212619\" data-rep=\"50\" data-anon=\"true\"><a class=\"js-add-link comments-link disabled-link \" title=\"Use comments to ask for more information or suggest improvements. Avoid comments like \u201c+1\u201d or \u201cthanks\u201d.\">add a comment<\/a><\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><a name=\"5213660\"><\/a><\/p>\n<div id=\"answer-5213660\" class=\"answer\" data-answerid=\"5213660\">\n<table>\n<tbody>\n<tr>\n<td class=\"votecell\">\n<div class=\"vote\"><a class=\"vote-up-off\" title=\"This answer is useful\">up vote<\/a> <span class=\"vote-count-post \">0<\/span> <a class=\"vote-down-off\" title=\"This answer is not useful\">down vote<\/a><\/div>\n<\/td>\n<td class=\"answercell\">\n<div class=\"post-text\">\n<p>If you want a file with insert statements for your data have a look here:<\/p>\n<blockquote><p>This procedure generates INSERT statements using existing data from the given tables and views. Later, you can use these INSERT statements to generate the data. It&#8217;s very useful when you have to ship or package a database application. This procedure also comes in handy when you have to send sample data to your vendor or technical support provider for troubleshooting purposes.<\/p><\/blockquote>\n<p><a href=\"http:\/\/vyaskn.tripod.com\/code.htm#inserts\" rel=\"nofollow\">http:\/\/vyaskn.tripod.com\/code.htm#inserts<\/a><\/p>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">In &#8220;Back UP&#8221; I only get a bak file, but I would like to create .sql file Sorgente: How to backup Sql Server to sql file? &#8211; Stack Overflow I may need it pretty soon<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/monodes.com\/predaelli\/2017\/02\/28\/how-to-backup-sql-server-to-sql-file-stack-overflow\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"link","meta":{"inline_featured_image":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-2209","post","type-post","status-publish","format-link","hentry","category-senza-categoria","post_format-post-format-link"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6daft-zD","jetpack-related-posts":[{"id":3522,"url":"https:\/\/monodes.com\/predaelli\/2017\/11\/22\/sql-server-why-should-an-application-not-use-the-sa-account-database-administrators-stack-exchange\/","url_meta":{"origin":2209,"position":0},"title":"sql server &#8211; Why should an application not use the sa account &#8211; Database Administrators Stack Exchange","author":"Paolo Redaelli","date":"2017-11-22","format":"status","excerpt":"sql server - Why should an application not use the sa account - Database Administrators Stack Exchange I understand that the sa account enables complete control over a SQL Server and all the databases, users, permissions etc. I have an absolute belief that applications should not use the sa password\u2026","rel":"","context":"In &quot;Proprietary software&quot;","block_context":{"text":"Proprietary software","link":"https:\/\/monodes.com\/predaelli\/category\/software\/proprietary-software\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2191,"url":"https:\/\/monodes.com\/predaelli\/2017\/02\/21\/hellish\/","url_meta":{"origin":2209,"position":1},"title":"Hellish\u00a0","author":"Paolo Redaelli","date":"2017-02-21","format":false,"excerpt":"Hell must be full of Microsoft servers that must be administered and reinstalled over and over again. I thought of being non proficient in Ms administration since I tried for two full days to install SQL server 2008 on a freshly installed Windows server 2008. I discovered that a whole-life\u2026","rel":"","context":"In &quot;Mood&quot;","block_context":{"text":"Mood","link":"https:\/\/monodes.com\/predaelli\/category\/mood\/"},"img":{"alt_text":"","src":"http:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2017\/02\/wp-image-1265243403jpeg.jpeg?w=528&resize=350%2C200","width":350,"height":200,"srcset":"http:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2017\/02\/wp-image-1265243403jpeg.jpeg?w=528&resize=350%2C200 1x, http:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2017\/02\/wp-image-1265243403jpeg.jpeg?w=528&resize=525%2C300 1.5x"},"classes":[]},{"id":9172,"url":"https:\/\/monodes.com\/predaelli\/2022\/03\/23\/sql-fiddle\/","url_meta":{"origin":2209,"position":2},"title":"SQL Fiddle","author":"Paolo Redaelli","date":"2022-03-23","format":"link","excerpt":"SQL Fiddle Application for testing and sharing SQL queries.","rel":"","context":"In &quot;Tricks&quot;","block_context":{"text":"Tricks","link":"https:\/\/monodes.com\/predaelli\/category\/documentations\/tricks\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8531,"url":"https:\/\/monodes.com\/predaelli\/2021\/06\/23\/take-your-sql-from-good-to-great-part-3\/","url_meta":{"origin":2209,"position":3},"title":"Take your SQL from Good to Great: Part 3","author":"Paolo Redaelli","date":"2021-06-23","format":"link","excerpt":"\u00a0 A quick inforgrafic of SQL joins: Time to join the JOIN movement. Take your SQL from Good to Great: Part 3 | by Taylor Brownlow | Jun, 2021 | Towards Data Science","rel":"","context":"In &quot;Documentations&quot;","block_context":{"text":"Documentations","link":"https:\/\/monodes.com\/predaelli\/category\/documentations\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":14199,"url":"https:\/\/monodes.com\/predaelli\/2025\/10\/26\/against-sql\/","url_meta":{"origin":2209,"position":4},"title":"Against SQL","author":"Paolo Redaelli","date":"2025-10-26","format":false,"excerpt":"Against SQL Against SQL Published 2021-07-09 TLDR The relational model is great: A shared universal data model allows cooperation between programs written in many different languages, running on different machines and with different lifespans. Normalization allows updating data without worrying about forgetting to update derived data. Physical data independence allows\u2026","rel":"","context":"In &quot;Documentations&quot;","block_context":{"text":"Documentations","link":"https:\/\/monodes.com\/predaelli\/category\/documentations\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":14160,"url":"https:\/\/monodes.com\/predaelli\/2025\/10\/21\/harlequin\/","url_meta":{"origin":2209,"position":5},"title":"Harlequin","author":"Paolo Redaelli","date":"2025-10-21","format":false,"excerpt":"Harlequin The Portable, powerful, colorful SQL IDE for Your Terminal. On Debian apt install harlequin","rel":"","context":"In &quot;Software&quot;","block_context":{"text":"Software","link":"https:\/\/monodes.com\/predaelli\/category\/software\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/2209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/comments?post=2209"}],"version-history":[{"count":0,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/2209\/revisions"}],"wp:attachment":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/media?parent=2209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/categories?post=2209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/tags?post=2209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}