<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Nav developer's blog : Basic SQL</title><link>http://blogs.msdn.com/nav_developer/archive/tags/Basic+SQL/default.aspx</link><description>Tags: Basic SQL</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Basic SQL - Restoring a SQL Server backup</title><link>http://blogs.msdn.com/nav_developer/archive/2008/11/08/basic-sql-restoring-a-sql-server-backup.aspx</link><pubDate>Sat, 08 Nov 2008 11:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9053909</guid><dc:creator>Lohndorf</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/nav_developer/comments/9053909.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nav_developer/commentrss.aspx?PostID=9053909</wfw:commentRss><description>&lt;P&gt;This post is part of "&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-overview-of-nav-specific-sql-features-for-application-consultants.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-overview-of-nav-specific-sql-features-for-application-consultants.aspx"&gt;Overview of NAV-specific SQL features for application consultants&lt;/A&gt;".&lt;/P&gt;
&lt;P&gt;You can back up your Microsoft Dynamics NAV database either from a NAV client or from SQL Server Management Studio. To restore a backup made from SQL Server, follow these steps: &lt;/P&gt;
&lt;P&gt;1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Open SQL Server Management Studio &lt;BR&gt;2)&amp;nbsp;&amp;nbsp;&amp;nbsp; You don’t need to create a database first, like you do from NAV. Just right click on Databases, then select “Restore Database...”. &lt;BR&gt;3)&amp;nbsp;&amp;nbsp;&amp;nbsp; In the box that opens, type in a name for your new database. You can name it anything. Then change the source from “From database” to “From device”. Device, in this case, just means file. &lt;BR&gt;4)&amp;nbsp;&amp;nbsp;&amp;nbsp; Click the Assist Edit button next to “From Device”, which opens a new dialogue box. Click Add, and then select the SQL backup you are restoring, and click OK. &lt;BR&gt;5)&amp;nbsp;&amp;nbsp;&amp;nbsp; SQL Server will list a few details about the backup you selected. Tick the “Restore” box, and then click OK: &lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLRestoringaSQLServerbackup_7954/Restore_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLRestoringaSQLServerbackup_7954/Restore_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=438 alt=Restore src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLRestoringaSQLServerbackup_7954/Restore_thumb.jpg" width=488 border=0 mce_src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLRestoringaSQLServerbackup_7954/Restore_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;The new database should now appear in SQL Server management studio, and you can access it from a NAV client.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lars Lohndorf-Larsen &lt;/P&gt;
&lt;P&gt;Microsoft Dynamics UK &lt;/P&gt;
&lt;P&gt;Microsoft Customer Service and Support (CSS) EMEA &lt;/P&gt;
&lt;P&gt;These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use. &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9053909" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nav_developer/archive/tags/SQL/default.aspx">SQL</category><category domain="http://blogs.msdn.com/nav_developer/archive/tags/Basic+SQL/default.aspx">Basic SQL</category></item><item><title>Basic SQL - Creating users in NAV on SQL</title><link>http://blogs.msdn.com/nav_developer/archive/2008/11/08/basic-sql-creating-users-in-nav-on-sql.aspx</link><pubDate>Sat, 08 Nov 2008 11:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9053907</guid><dc:creator>Lohndorf</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/nav_developer/comments/9053907.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nav_developer/commentrss.aspx?PostID=9053907</wfw:commentRss><description>&lt;P&gt;This post is part of "&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-overview-of-nav-specific-sql-features-for-application-consultants.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-overview-of-nav-specific-sql-features-for-application-consultants.aspx"&gt;Overview of NAV-specific SQL features for application consultants&lt;/A&gt;".&lt;/P&gt;
&lt;P&gt;Before you can set up a user in Microsoft Dynamics NAV on SQL Server, you must create the user on SQL Server first. If you try to create a user which does not exist on SQL Server, you will get this error message:&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;=== &lt;BR&gt;The Microsoft Dynamics NAV Classic and SQL Server security systems have not been successfully synchronized.&amp;nbsp; The SQL Server login MYUSER does not exist on the LARS-PC server. &lt;/P&gt;
&lt;P&gt;===&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingusersinNAVonSQL_785A/NoUserExists_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingusersinNAVonSQL_785A/NoUserExists_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=168 alt=NoUserExists src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingusersinNAVonSQL_785A/NoUserExists_thumb.jpg" width=424 border=0 mce_src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingusersinNAVonSQL_785A/NoUserExists_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;To create this user on SQL Server follow these steps: &lt;BR&gt;1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Open SQL Server Management Studio and expand the group Security -&amp;gt; Logins. &lt;BR&gt;2)&amp;nbsp;&amp;nbsp;&amp;nbsp; Right click on “Logins” and select “New Login”. Type in the name of the user. &lt;BR&gt;3)&amp;nbsp;&amp;nbsp;&amp;nbsp; Change from “Windows Authentication” to “SQL Server authentication”, and then type in (and remember) a password. &lt;BR&gt;4)&amp;nbsp;&amp;nbsp;&amp;nbsp; If you leave the checkmark “Enforce Password Policy” enabled, then the password you select must be complex enough to live up to the policy. If you disable this checkmark you can choose any password you like, or even leave it blank. &lt;BR&gt;5)&amp;nbsp;&amp;nbsp;&amp;nbsp; Un-tick “User must change password at next login”. Otherwise the user will not be able to log into NAV at all. &lt;BR&gt;6)&amp;nbsp;&amp;nbsp;&amp;nbsp; Under “Default Database”, select the NAV database that you want the user to access.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingusersinNAVonSQL_785A/CreateUser_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingusersinNAVonSQL_785A/CreateUser_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=473 alt=CreateUser src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingusersinNAVonSQL_785A/CreateUser_thumb.jpg" width=527 border=0 mce_src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingusersinNAVonSQL_785A/CreateUser_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;7)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If you want this user to access more than one database, then click on “User Mapping”, and select the databases that you want to give the user access to. Otherwise just click on OK, and the user is ready to be used.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingusersinNAVonSQL_785A/UserMapping_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingusersinNAVonSQL_785A/UserMapping_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=138 alt=UserMapping src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingusersinNAVonSQL_785A/UserMapping_thumb.jpg" width=539 border=0 mce_src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingusersinNAVonSQL_785A/UserMapping_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;8)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; You don’t need to assign any permissions on the SQL Server. As long as the user exists on SQL, then you can use it, and assign permissions from a NAV client. &lt;BR&gt;9)&amp;nbsp;&amp;nbsp;&amp;nbsp; So open the database in NAV, and go to “Database Logins” (Tools -&amp;gt; Security -&amp;gt; Database Logins), and then enter the User ID for the user you created, and then assign the appropriate roles. &lt;/P&gt;
&lt;P&gt;Synchronize permissions &lt;BR&gt;One more step is needed if you run NAV on SQL Server compared to Native. Depending on the security model in the database, you may need to also synchronize permissions. You can see and change the security model from NAV under File -&amp;gt; Database -&amp;gt; Alter:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingusersinNAVonSQL_785A/SecurityModel_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingusersinNAVonSQL_785A/SecurityModel_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=237 alt=SecurityModel src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingusersinNAVonSQL_785A/SecurityModel_thumb.jpg" width=563 border=0 mce_src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingusersinNAVonSQL_785A/SecurityModel_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;The security model defaults to Enhanced, but for a test system it is simpler to change it to Standard. To change it, you must also (temporarily) select “Single User” from the “Options”-tab. Changing the security model will automatically rebuild all the permissions. After this is done, don’t forget to go back and un-tick “Single User” again. &lt;/P&gt;
&lt;P&gt;If your database is set to use Enhanced security model, then every time you change or create users, roles or permissions, then you must also synchronize this by going to Tools -&amp;gt; Security -&amp;gt; “Synchronize all logins” before the changes take effect. &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lars Lohndorf-Larsen &lt;/P&gt;
&lt;P&gt;Microsoft Dynamics UK &lt;/P&gt;
&lt;P&gt;Microsoft Customer Service and Support (CSS) EMEA &lt;/P&gt;
&lt;P&gt;These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use. &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9053907" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nav_developer/archive/tags/SQL/default.aspx">SQL</category><category domain="http://blogs.msdn.com/nav_developer/archive/tags/Basic+SQL/default.aspx">Basic SQL</category></item><item><title>Basic SQL - How to attach a database to SQL Server</title><link>http://blogs.msdn.com/nav_developer/archive/2008/11/08/basic-sql-how-to-attach-a-database-to-sql-server.aspx</link><pubDate>Sat, 08 Nov 2008 11:27:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9053900</guid><dc:creator>Lohndorf</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/nav_developer/comments/9053900.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nav_developer/commentrss.aspx?PostID=9053900</wfw:commentRss><description>&lt;P&gt;This post is part of "&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-overview-of-nav-specific-sql-features-for-application-consultants.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-overview-of-nav-specific-sql-features-for-application-consultants.aspx"&gt;Overview of NAV-specific SQL features for application consultants&lt;/A&gt;".&lt;/P&gt;
&lt;P&gt;If you receive a SQL Server database file (.MDF), then you must attach this to your SQL Server before you can access it. This is how to do that: &lt;/P&gt;
&lt;P&gt;1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Copy the Database file (.MDF), for example “Demo Database NAV (6-0)_Data.MDF” into the folder where SQL Server keeps the database files. On SQL Server 2008 this defaults to “C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA”:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/CopyDBFile_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/CopyDBFile_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=421 alt=CopyDBFile src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/CopyDBFile_thumb.jpg" width=560 border=0 mce_src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/CopyDBFile_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;2)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Open SQL Server Management Studio. Note: On Windows Vista / Windows 2008, you &lt;STRONG&gt;must&lt;/STRONG&gt; open it as Administrator to have the right permissions. Otherwise the next steps might fail, and maybe without giving you any error messages:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/OpenAsAdmin_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/OpenAsAdmin_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=371 alt=OpenAsAdmin src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/OpenAsAdmin_thumb.jpg" width=238 border=0 mce_src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/OpenAsAdmin_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;3)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; In SQL Server Management Studio right click on Databases, select Attach... click Add, then select the file you copied in step 1, then click OK: &lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/AddDB_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/AddDB_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=504 alt=AddDB src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/AddDB_thumb.jpg" width=607 border=0 mce_src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/AddDB_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;4)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The database file may be pointing to a transaction log which you don’t have and don’t need. So, before clicking OK again, check if there is a reference to the transaction log under “Database Details”. Remove it if there is, and then click OK: &lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/RemoveTransactionLog_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/RemoveTransactionLog_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=559 alt=RemoveTransactionLog src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/RemoveTransactionLog_thumb.jpg" width=623 border=0 mce_src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/RemoveTransactionLog_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;5)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If you receive any warnings about adding catalogues, then ignore those. As long as you now see the new database in SQL Server Management Studio:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/DatabaseAttached_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/DatabaseAttached_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=532 alt=DatabaseAttached src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/DatabaseAttached_thumb.jpg" width=338 border=0 mce_src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLHowtoattachadatabasetoSQLServer_76D5/DatabaseAttached_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;You should now be able to open the database with a NAV client. Note, the SQL backup will contain any user IDs and permissions that were created in the database, so you would need to know what login to use. In the case of Windows logins, of course if the database came from another system / another domain, then any Windows logins will not be valid on your domain.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lars Lohndorf-Larsen &lt;/P&gt;
&lt;P&gt;Microsoft Dynamics UK &lt;/P&gt;
&lt;P&gt;Microsoft Customer Service and Support (CSS) EMEA &lt;/P&gt;
&lt;P&gt;These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use. &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9053900" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nav_developer/archive/tags/SQL/default.aspx">SQL</category><category domain="http://blogs.msdn.com/nav_developer/archive/tags/Basic+SQL/default.aspx">Basic SQL</category></item><item><title>Basic SQL - How to create a new NAV database for restoring a NAV backup</title><link>http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-how-to-create-a-new-nav-database-for-restoring-a-nav-backup.aspx</link><pubDate>Wed, 05 Nov 2008 17:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9044398</guid><dc:creator>Lohndorf</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/nav_developer/comments/9044398.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nav_developer/commentrss.aspx?PostID=9044398</wfw:commentRss><description>&lt;P&gt;This post is part of "&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-overview-of-nav-specific-sql-features-for-application-consultants.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-overview-of-nav-specific-sql-features-for-application-consultants.aspx"&gt;Overview of NAV-specific SQL features for application consultants&lt;/A&gt;".&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This post describes the steps needed to create a new NAV database from a NAV backup (.fbk) file. All the steps are done from a NAV client: &lt;/P&gt;
&lt;P&gt;1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Start a NAV client (finsql.exe), then go to File -&amp;gt; Database -&amp;gt; New. In Server Name, enter (local)&amp;nbsp; - assuming you have SQL Server on the same machine. Then click OK.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;2)&amp;nbsp;&amp;nbsp;&amp;nbsp; You only have to enter a database name, and click OK. But if the database is used for test purposes, I would also recommend you change “Recovery Model” from Full to Simple (Options tab), and change “Security Model” from Enhanced to Standard (Advanced tab). Then click OK.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;3)&amp;nbsp;&amp;nbsp;&amp;nbsp; Now you have a blank NAV database. All you have to do, is to restore your NAV backup (.fbk) file: Tools -&amp;gt; Restore.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;4)&amp;nbsp;&amp;nbsp;&amp;nbsp; If you want to change the NAV license, then go to Tools -&amp;gt; License Information, and click Upload, and select the NAV license. This uploads the license to the SQL Server, and it will be stored there for the next time you start NAV. &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lars Lohndorf-Larsen&lt;/P&gt;
&lt;P&gt;Microsoft Dynamics UK&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Microsoft Customer Service and Support (CSS) EMEA&lt;/P&gt;
&lt;P&gt;These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use. &lt;BR&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9044398" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nav_developer/archive/tags/SQL/default.aspx">SQL</category><category domain="http://blogs.msdn.com/nav_developer/archive/tags/Basic+SQL/default.aspx">Basic SQL</category></item><item><title>Basic SQL - Enable trace flag 4616 on SQL Server</title><link>http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-enable-trace-flag-4616-on-sql-server.aspx</link><pubDate>Wed, 05 Nov 2008 17:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9044389</guid><dc:creator>Lohndorf</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/nav_developer/comments/9044389.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nav_developer/commentrss.aspx?PostID=9044389</wfw:commentRss><description>&lt;P mce_keep="true"&gt;This post is part of "&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-overview-of-nav-specific-sql-features-for-application-consultants.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-overview-of-nav-specific-sql-features-for-application-consultants.aspx"&gt;Overview of NAV-specific SQL features for application consultants&lt;/A&gt;".&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The newest versions of Microsoft Dynamics NAV require trace flag 4616 to be enabled on SQL Server. If not, then you will get this error message when you try to connect:&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;=== &lt;BR&gt;The trace flag 4616 is not set on the server (local). You must set this flag and restart the server before you can connect using Microsoft Dynamics NAV. &lt;/P&gt;
&lt;P&gt;===&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLEnabletraceflag4616onSQLServer_CFBB/Error4616_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLEnabletraceflag4616onSQLServer_CFBB/Error4616_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=195 alt=Error4616 src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLEnabletraceflag4616onSQLServer_CFBB/Error4616_thumb.jpg" width=519 border=0 mce_src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLEnabletraceflag4616onSQLServer_CFBB/Error4616_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;H2&gt;How to set trace flag 4616:&lt;/H2&gt;
&lt;P&gt;&lt;BR&gt;Start SQL Server Configuration Manager: &lt;BR&gt;Start -&amp;gt; All Programs -&amp;gt; Microsoft SQL Server 2005/8 -&amp;gt; Configuration Tools -&amp;gt; SQL Server Configuration Manager &lt;BR&gt;On the left side, select “SQL Server Services”, then Locate” SQL Server (MSSQLSERVER)” on the right side. Right click it and select Properties. Then select the Advanced tab:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLEnabletraceflag4616onSQLServer_CFBB/SQLConfigManager_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLEnabletraceflag4616onSQLServer_CFBB/SQLConfigManager_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=352 alt=SQLConfigManager src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLEnabletraceflag4616onSQLServer_CFBB/SQLConfigManager_thumb.jpg" width=466 border=0 mce_src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLEnabletraceflag4616onSQLServer_CFBB/SQLConfigManager_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Then add the startup parameter at the end of the existing ones (separating the existing ones with a semi-colon): &lt;BR&gt;;-t4616&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Then click OK. &lt;BR&gt;You must restart the SQL Server service before this setting takes effect: Right click on “SQL Server (MSSQLSERVER)” again, and this time select Restart. &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Lars Lohndorf-Larsen&lt;/P&gt;
&lt;P&gt;Microsoft Dynamics UK&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Microsoft Customer Service and Support (CSS) EMEA&lt;/P&gt;
&lt;P&gt;These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use. &lt;BR&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9044389" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nav_developer/archive/tags/SQL/default.aspx">SQL</category><category domain="http://blogs.msdn.com/nav_developer/archive/tags/Basic+SQL/default.aspx">Basic SQL</category></item><item><title>Basic SQL - Creating Extended Stored Procedure / xp_ndo.dll</title><link>http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-creating-extended-stored-procedure-xp-ndo-dll.aspx</link><pubDate>Wed, 05 Nov 2008 17:43:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9044379</guid><dc:creator>Lohndorf</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/nav_developer/comments/9044379.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nav_developer/commentrss.aspx?PostID=9044379</wfw:commentRss><description>&lt;P&gt;This post is part of "&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-overview-of-nav-specific-sql-features-for-application-consultants.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-overview-of-nav-specific-sql-features-for-application-consultants.aspx"&gt;Overview of NAV-specific SQL features for application consultants&lt;/A&gt;".&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Microsoft Dynamics NAV requires two extended stored procedures from xp_ndo.dll to exist on SQL Server if Windows logins are used. If these extended stored procedures do not exist, you will get this error when trying to log on using Windows Authentication: &lt;/P&gt;
&lt;P&gt;--- &lt;BR&gt;The extended stored procedure xp_ndo_enumusersids in the library file xp_ndo.dll, is not available on the LOHNDORF1 server.&amp;nbsp; Until this procedure and library have been added, it will not be possible to connect to this server from Microsoft Dynamics NAV with Windows Authentication, but you will still be able to connect with Database Server Authentication.&amp;nbsp; You can read more about adding this extended stored procedure in the help pages on the product CD. Follow the hyperlink to the readme.txt file on the Servers page under the Documentation section of SQL Server. &lt;/P&gt;
&lt;P&gt;---&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingExtendedStoredProced.dll_CEF2/XP_Ndo_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingExtendedStoredProced.dll_CEF2/XP_Ndo_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=321 alt=XP_Ndo src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingExtendedStoredProced.dll_CEF2/XP_Ndo_thumb.jpg" width=491 border=0 mce_src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingExtendedStoredProced.dll_CEF2/XP_Ndo_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;When this happens you have two options: Use Database Authentication instead, or create the extended stored procedures on the SQL Server. a normal installation of a NAV client will create these procedures automatically, which is why in most cases you don’t need to do it. But if for some reason it was not created, then this is how to do it manually: &lt;/P&gt;
&lt;P&gt;1)&amp;nbsp;&amp;nbsp;&amp;nbsp; From the product DVD, open the folder sql_esp, and run the file xp_ndo.exe to extract the file xp_ndo.dll somewhere you your disk. Then copy it into this folder on your SQL Server (on SQL 2008): C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Binn\. Remember, copying files into the “Program Files”-folder requires administrative privileges on Vista and Windows2008, which is why you should extract the file to a different folder first, and then copy it into this location.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;2)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Open SQL Server Management Studio. Extend Databases -&amp;gt; System Databases -&amp;gt; master -&amp;gt; Programmability. Right click on “Extended stored procedures”, and select “New extended stored procedure”.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;3)&amp;nbsp;&amp;nbsp;&amp;nbsp; Name it xp_ndo_enumusersids, and in the DLL field, select the full file and path for xp_ndo.dll (on SQL Server 2008 C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Binn\xp_ndo.dll): &lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingExtendedStoredProced.dll_CEF2/CreateXP_Ndo_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingExtendedStoredProced.dll_CEF2/CreateXP_Ndo_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=214 alt=CreateXP_Ndo src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingExtendedStoredProced.dll_CEF2/CreateXP_Ndo_thumb.jpg" width=582 border=0 mce_src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingExtendedStoredProced.dll_CEF2/CreateXP_Ndo_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;4)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assign permissions to the public role: In the Extended Stored Procedures properties, click on “Permissions”, then “Search”. Type in “Public”, and click OK. Then assign Execute permissions to Public:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingExtendedStoredProced.dll_CEF2/AssignPermissions_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingExtendedStoredProced.dll_CEF2/AssignPermissions_2.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=367 alt=AssignPermissions src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingExtendedStoredProced.dll_CEF2/AssignPermissions_thumb.jpg" width=514 border=0 mce_src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLCreatingExtendedStoredProced.dll_CEF2/AssignPermissions_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;5)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Finally, repeat the previous steps and make another extended stored procedure which is exactly identical, except this one must be called xp_ndo_enumusergroups instead of xp_ndo_enumusersids. &lt;/P&gt;
&lt;P&gt;You should now have two extended stored procedures, and should be able to use Windows login from NAV. &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lars Lohndorf-Larsen&lt;/P&gt;
&lt;P&gt;Microsoft Dynamics UK&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Microsoft Customer Service and Support (CSS) EMEA&lt;/P&gt;
&lt;P&gt;These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9044379" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nav_developer/archive/tags/SQL/default.aspx">SQL</category><category domain="http://blogs.msdn.com/nav_developer/archive/tags/Basic+SQL/default.aspx">Basic SQL</category></item><item><title>Basic SQL - Installing SQL Server 2005 / 2008</title><link>http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-installing-sql-server-2005-2008.aspx</link><pubDate>Wed, 05 Nov 2008 17:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9044349</guid><dc:creator>Lohndorf</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/nav_developer/comments/9044349.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nav_developer/commentrss.aspx?PostID=9044349</wfw:commentRss><description>&lt;P&gt;This post is part of "&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-overview-of-nav-specific-sql-features-for-application-consultants.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-overview-of-nav-specific-sql-features-for-application-consultants.aspx"&gt;Overview of NAV-specific SQL features for application consultants&lt;/A&gt;".&lt;/P&gt;
&lt;P&gt;It describes the simplest way to get SQL Server installed in a test environment. It only mentions the changes to the default installation options that you need to make to get SQL Server running for NAV. Needless to say that for installing SQL Server in a live environment, there are further considerations to make like security, performance, etc, which are not described here. &lt;/P&gt;
&lt;H2&gt;Which edition: &lt;/H2&gt;
&lt;P&gt;If you have a choice of editions, then for a test system choose Developer Edition unless you have specific reasons to chose something else. &lt;/P&gt;
&lt;H2&gt;Installation options:&lt;/H2&gt;
&lt;P&gt;The following options are for installing SQL Server 2008, but the same options exist when installing SQL Server 2005, even though the menus may look slightly different.&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;The minimum features that you need to install are: &lt;BR&gt;&amp;nbsp; “Database Engine Services” &lt;BR&gt;&amp;nbsp; “Management Tools” &lt;BR&gt;But I would also recommend installing “SQL Server Books Online”: &lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLInstallingSQLServer20052008_CCC8/InstallOptions.jpg" mce_href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLInstallingSQLServer20052008_CCC8/InstallOptions.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=393 alt=InstallOptions src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLInstallingSQLServer20052008_CCC8/InstallOptions_thumb.jpg" width=525 border=0 mce_src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLInstallingSQLServer20052008_CCC8/InstallOptions_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Another decision you have to make, is which account the SQL Server Services run under. When prompted for this, for a &lt;STRONG&gt;test&lt;/STRONG&gt; system, set all SQL Server Services to use the “NT Authority\SYSTEM” account (just specify the account, and leave password blank). When installing SQL Server 2008 it looks like this – for SQL Server 2005 it looks slightly different: &lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLInstallingSQLServer20052008_CCC8/SelectAccounts.jpg" mce_href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLInstallingSQLServer20052008_CCC8/SelectAccounts.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=308 alt=SelectAccounts src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLInstallingSQLServer20052008_CCC8/SelectAccounts_thumb.jpg" width=548 border=0 mce_src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLInstallingSQLServer20052008_CCC8/SelectAccounts_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;The final place where you should deviate from the default installation options, is to set Authentication Mode to “Mixed Mode”. As default, SQL Server will only use Windows Authentication. Setting it to “Mixed Mode” also gives you a database login, which can be useful in some cases:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLInstallingSQLServer20052008_CCC8/MixedMode.jpg" mce_href="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLInstallingSQLServer20052008_CCC8/MixedMode.jpg"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=364 alt=MixedMode src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLInstallingSQLServer20052008_CCC8/MixedMode_thumb.jpg" width=525 border=0 mce_src="http://blogs.msdn.com/blogfiles/nav_developer/WindowsLiveWriter/BasicSQLInstallingSQLServer20052008_CCC8/MixedMode_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Remember the password you specify here! This password is for the sa account, so you will always be able to log in to SQL Server as System Administrator with user ID "sa" and the password you decide here. &lt;/P&gt;
&lt;P&gt;Use default options for the rest of the installation.&lt;/P&gt;
&lt;P&gt;Once you have installed SQL Server, then you will find “SQL Server Management Studio” in the start menu, which is where you can do all the admin tasks that you need.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lars Lohndorf-Larsen&lt;/P&gt;
&lt;P&gt;Microsoft Dynamics UK&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Microsoft Customer Service and Support (CSS) EMEA&lt;/P&gt;
&lt;P&gt;These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use. &lt;BR&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9044349" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nav_developer/archive/tags/SQL/default.aspx">SQL</category><category domain="http://blogs.msdn.com/nav_developer/archive/tags/Basic+SQL/default.aspx">Basic SQL</category></item><item><title>Basic SQL - Overview of NAV specific SQL features for application consultants</title><link>http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-overview-of-nav-specific-sql-features-for-application-consultants.aspx</link><pubDate>Wed, 05 Nov 2008 11:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9043793</guid><dc:creator>Lohndorf</dc:creator><slash:comments>23</slash:comments><comments>http://blogs.msdn.com/nav_developer/comments/9043793.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nav_developer/commentrss.aspx?PostID=9043793</wfw:commentRss><description>&lt;P&gt;As the title says, this post is not really for NAV developers, but for application consultants who don't use SQL Server every day but still need to know enough about SQL Server to at least get a Microsoft Dynamics NAV database to run on&amp;nbsp;it. &lt;/P&gt;
&lt;P&gt;The challenge is, that even a basic&amp;nbsp;SQL course or book will cover material which is 85% unrelated to NAV, and cover SQL features which you may never use when you only need to run NAV on a SQL server in a test environment. So the point of this post is to explain the basic steps needed to get NAV up and running on SQL Server (2005 / 2008) in the simplest and shortest way possible. &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will assume that the instructions here will only be used to get NAV to run in a test environment, and not cover any features like security and performance which should be considered for a live system. Also, I will only explain the minimum&amp;nbsp;steps needed to get NAV to run - not any background of why this or that needs to be done.&lt;/P&gt;
&lt;P&gt;This post contains a very general overview, and then&amp;nbsp;links to a number of seperate posts for each individual area. So you can use this for an overview / table of content, and then link to the specific topic that you need.&lt;/P&gt;
&lt;P&gt;These are the areas planned for now - more may follow:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-installing-sql-server-2005-2008.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-installing-sql-server-2005-2008.aspx"&gt;Instaling SQL Server&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-creating-extended-stored-procedure-xp-ndo-dll.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-creating-extended-stored-procedure-xp-ndo-dll.aspx"&gt;Create stored procedure from xp_ndo.dll for Windows authentication&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-enable-trace-flag-4616-on-sql-server.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-enable-trace-flag-4616-on-sql-server.aspx"&gt;Enable trace flag 4616&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-how-to-create-a-new-nav-database-for-restoring-a-nav-backup.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-how-to-create-a-new-nav-database-for-restoring-a-nav-backup.aspx"&gt;Create a NAV database&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/08/basic-sql-how-to-attach-a-database-to-sql-server.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/08/basic-sql-how-to-attach-a-database-to-sql-server.aspx"&gt;Attach a NAV database&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/08/basic-sql-restoring-a-sql-server-backup.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/08/basic-sql-restoring-a-sql-server-backup.aspx"&gt;Restore a SQL backup of a NAV database&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/08/basic-sql-creating-users-in-nav-on-sql.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/08/basic-sql-creating-users-in-nav-on-sql.aspx"&gt;Creating users on SQL Server for use in NAV&lt;/A&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P mce_keep="true"&gt;All the posts are tagged "Basic SQL", so you can list them from &lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/tags/Basic+SQL/default.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/tags/Basic+SQL/default.aspx"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;1.&amp;nbsp; Installing SQL Server&lt;/STRONG&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;When installing a NAV client you have the option to install the SQL Server engine as well, and the installation will automatically attach a NAV database ready to use. As long as this works&amp;nbsp;for you you don't have to install SQL Server as well. But if something needs changing or troubleshooting, or if you need to attach a different SQL database, then you need the admin tool (SQL Server Management Studio), which is when you need to install SQL Server.&lt;/P&gt;
&lt;P mce_keep="true"&gt;The installation is fairly straigthforward. You should just change two of the default options:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;&amp;nbsp; Set all SQL Server services to use the System account, and&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;&amp;nbsp; change the authentication mode from "Windows Authentication" to "Mixed Mode"&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P mce_keep="true"&gt;For further details, go to this post:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp; &lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-installing-sql-server-2005-2008.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-installing-sql-server-2005-2008.aspx"&gt;Installing SQL Server&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;2.&amp;nbsp; Create stored procedure from xp_ndo.dll for Windows authentication&lt;/STRONG&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;NAV requires two extended stored procedures called xp_ndo_enumusergroups and xp_ndo_enumusersids, both based on xp_ndo.dll (can be found in the sql_esp folder on the product DVD). If these extended stored procedures are not present, and you try to log in with Windows Authentication, you will get this error message:&lt;/P&gt;
&lt;P mce_keep="true"&gt;====&lt;BR&gt;The extended stored procedure xp_ndo_enumusersids in the library file xp_ndo.dll, is not available on the LOHNDORF1 server.&amp;nbsp; Until this procedure and library have been added, it will not be possible to connect to this server from Microsoft Dynamics NAV with Windows Authentication, but you will still be able to connect with Database Server Authentication.&amp;nbsp; You can read more about adding this extended stored procedure in the help pages on the product CD. Follow the hyperlink to the readme.txt file on the Servers page under the Documentation section of SQL Server. &lt;BR&gt;====&lt;/P&gt;
&lt;P mce_keep="true"&gt;For details on how to create these two extended stored procedures, follow this post:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-creating-extended-stored-procedure-xp-ndo-dll.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-creating-extended-stored-procedure-xp-ndo-dll.aspx"&gt;Creating extended stored procedures in xp_ndo.dll&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;3.&amp;nbsp; Enable trace flag 4616&lt;/STRONG&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Since NAV version 4 Sp3 the NAV client requires this trace flag to be enabled on SQL Server. If it's not, then you will get this error when trying to connect to a SQL database from NAV:&lt;/P&gt;
&lt;P mce_keep="true"&gt;====&lt;BR&gt;The trace flag 4616 is not set on the server (local). You must set this flag and restart the server before you can connect using Microsoft Dynamics NAV. &lt;/P&gt;
&lt;P mce_keep="true"&gt;====&lt;/P&gt;
&lt;P mce_keep="true"&gt;Enable the trace flag by adding ;-t4616 to the end of startup parameters, and then restarting the SQL Server service. For furhter details how to do this, follow this post:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-enable-trace-flag-4616-on-sql-server.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-enable-trace-flag-4616-on-sql-server.aspx"&gt;Enabling trace flag 4616&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;4.&amp;nbsp; How to create a NAV database&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Creating a new database on SQL Server is almost identical to creating a new database on native: File -&amp;gt; Database -&amp;gt; New, then enter name etc. And, from there restore a NAV backup (.fbk file). More details - if needed - here:&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-how-to-create-a-new-nav-database-for-restoring-a-nav-backup.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/05/basic-sql-how-to-create-a-new-nav-database-for-restoring-a-nav-backup.aspx"&gt;Creating a NAV database from a NAV backup (.fbk file)&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;5.&amp;nbsp; Attach a&amp;nbsp;SQL database&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Attaching a SQL database is done entirely from the SQL Server environment (SQL Server Management Studio). It's not often you would need to do this. But for example if you want to attach the demo database from the product DVD,&amp;nbsp;then this is how to do that:&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/08/basic-sql-how-to-attach-a-database-to-sql-server.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/08/basic-sql-how-to-attach-a-database-to-sql-server.aspx"&gt;Attaching a SQL database&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;6.&amp;nbsp; Restore a SQL backup of a NAV database&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;With NAV on SQL Server you can either use the native backup or SQL Server backups. If a backup was done with SQL Server, you also need SQL Server to restore it. SQL Server backups are generally quicker than a NAV backup, but also often larger. Your SQL Server backup strtegy can be as complex as you like, but restoring a singe, complete backup is quite simple:&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/08/basic-sql-restoring-a-sql-server-backup.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/08/basic-sql-restoring-a-sql-server-backup.aspx"&gt;Restoring a SQL backup of a NAV database&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;7.&amp;nbsp; Creating users on SQL Server for use in NAV&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;When setting up a user for NAV, this user first has to exist on SQL Server. So you have to create the user under Security -&amp;gt; Logins in SQL Server Management Studio before creating them in NAV:&lt;/P&gt;
&lt;P&gt;&lt;A class="" href="http://blogs.msdn.com/nav_developer/archive/2008/11/08/basic-sql-creating-users-in-nav-on-sql.aspx" target=_blank mce_href="http://blogs.msdn.com/nav_developer/archive/2008/11/08/basic-sql-creating-users-in-nav-on-sql.aspx"&gt;Creating users on SQL Server for use in NAV&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;Lars Lohndorf-Larsen&lt;/P&gt;
&lt;P&gt;Microsoft Dynamics UK&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;Microsoft Customer Service and Support (CSS) EMEA&lt;/P&gt;
&lt;P&gt;These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.&amp;nbsp;&lt;/P&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9043793" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nav_developer/archive/tags/SQL/default.aspx">SQL</category><category domain="http://blogs.msdn.com/nav_developer/archive/tags/Basic+SQL/default.aspx">Basic SQL</category></item></channel></rss>