<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bahramov's Personal Blog &#187; SQL</title>
	<atom:link href="http://www.bahramov.com/tag/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bahramov.com</link>
	<description>Computers, databases, networks and virtualization</description>
	<lastBuildDate>Fri, 24 Jun 2011 12:05:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>T-SQL: Find logical name and physical location of system databases</title>
		<link>http://www.bahramov.com/2009/11/03/t-sql-find-logical-name-and-physical-location-of-system-databases/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.bahramov.com/2009/11/03/t-sql-find-logical-name-and-physical-location-of-system-databases/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 14:01:04 +0000</pubDate>
		<dc:creator>Zaur Bahramov</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.bahramov.com/2009/11/03/t-sql-find-logical-name-and-physical-location-of-system-databases/</guid>
		<description><![CDATA[The following T-SQL statements will print the logical name and physical location of system database files:
USE master;
GO
SELECT name, physical_name AS CurrentLocation, state_desc
FROM sys.master_files
WHERE database_id = DB_ID(N'master')

SELECT name, physical_name AS CurrentLocation, state_desc
FROM sys.master_files
WHERE database_id = DB_ID(N'tempdb')

SELECT name, physical_name AS CurrentLocation, state_desc
FROM sys.master_files
WHERE database_id = DB_ID(N'model')

SELECT name, physical_name AS CurrentLocation, state_desc
FROM sys.master_files
WHERE database_id = DB_ID(N'msdb')

Result:

]]></description>
			<content:encoded><![CDATA[<p>The following T-SQL statements will print the logical name and physical location of system database files:</p>
<pre class="code"><span style="color: blue">USE master</span><span style="color: gray">;
</span><span style="color: blue">GO
SELECT </span>name<span style="color: gray">, </span>physical_name <span style="color: blue">AS </span>CurrentLocation<span style="color: gray">, </span>state_desc
<span style="color: blue">FROM </span><span style="color: green">sys</span><span style="color: gray">.</span><span style="color: green">master_files
</span><span style="color: blue">WHERE </span>database_id <span style="color: gray">= </span><span style="color: magenta">DB_ID</span><span style="color: gray">(</span><span style="color: red">N'master'</span><span style="color: gray">)

</span><span style="color: blue">SELECT </span>name<span style="color: gray">, </span>physical_name <span style="color: blue">AS </span>CurrentLocation<span style="color: gray">, </span>state_desc
<span style="color: blue">FROM </span><span style="color: green">sys</span><span style="color: gray">.</span><span style="color: green">master_files
</span><span style="color: blue">WHERE </span>database_id <span style="color: gray">= </span><span style="color: magenta">DB_ID</span><span style="color: gray">(</span><span style="color: red">N'tempdb'</span><span style="color: gray">)

</span><span style="color: blue">SELECT </span>name<span style="color: gray">, </span>physical_name <span style="color: blue">AS </span>CurrentLocation<span style="color: gray">, </span>state_desc
<span style="color: blue">FROM </span><span style="color: green">sys</span><span style="color: gray">.</span><span style="color: green">master_files
</span><span style="color: blue">WHERE </span>database_id <span style="color: gray">= </span><span style="color: magenta">DB_ID</span><span style="color: gray">(</span><span style="color: red">N'model'</span><span style="color: gray">)

</span><span style="color: blue">SELECT </span>name<span style="color: gray">, </span>physical_name <span style="color: blue">AS </span>CurrentLocation<span style="color: gray">, </span>state_desc
<span style="color: blue">FROM </span><span style="color: green">sys</span><span style="color: gray">.</span><span style="color: green">master_files
</span><span style="color: blue">WHERE </span>database_id <span style="color: gray">= </span><span style="color: magenta">DB_ID</span><span style="color: gray">(</span><span style="color: red">N'msdb'</span><span style="color: gray">)
</span></pre>
<p><strong>Result:</strong></p>
<p><a href="http://www.bahramov.com/wp-content/uploads/2009/11/image.png#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed" title="image"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.bahramov.com/wp-content/uploads/2009/11/image_thumb.png" width="600" height="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bahramov.com/2009/11/03/t-sql-find-logical-name-and-physical-location-of-system-databases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Web Assistant: Could not open the output file.</title>
		<link>http://www.bahramov.com/2009/03/19/sql-web-assistant-could-not-open-the-output-file/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://www.bahramov.com/2009/03/19/sql-web-assistant-could-not-open-the-output-file/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 15:03:53 +0000</pubDate>
		<dc:creator>Zaur Bahramov</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[sp_makewebtask]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.bahramov.com/?p=66</guid>
		<description><![CDATA[Error Message:
Msg 16821, Level 11, State 1, Procedure sp_makewebtask, Line 131
SQL Web Assistant: Could not open the output file.
____________________________
Script completed with errors

Description:
This error message appears when you try to call the procedure sp_makewebtask but the output file cannot be opened.
Consequences:
The T-SQL statement can be parsed, but causes the error at runtime.
Resolution:
Errors of the Severity Level [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Error Message:</strong><br />
<code><span style="color: #ff0000">Msg 16821, Level 11, State 1, Procedure sp_makewebtask, Line 131<br />
SQL Web Assistant: Could not open the output file.<br />
____________________________<br />
Script completed with errors</span><br />
</code></p>
<p><strong>Description:</strong><br />
This error message appears when you try to call the procedure sp_makewebtask but the output file cannot be opened.</p>
<p><strong>Consequences:</strong><br />
The T-SQL statement can be parsed, but causes the error at runtime.</p>
<p><strong>Resolution:</strong><br />
Errors of the Severity Level 11 are generated by the user and are corrigible by the user. The statement cannot be executed this way. You must specify a valid and accessible path. <span style="text-decoration: underline;">Also you have to make sure that the Service Logon account for SQL Server has appropriate rights to write to the specified location.<br />
</span></p>
<p><strong>Versions:</strong><br />
All versions of SQL Server.</p>
<p><strong>Example(s):</strong></p>
<pre class="brush: sql">
-- In this example we try to call the sp_makewebtask procedure
-- to output the result to a file on drive A:\. As our machine
-- does not have such a drive, the error is raised.

EXEC sp_makewebtask &#039;A:\test.html&#039;,&#039;SELECT * FROM Northwind.dbo.Orders&#039; </pre>
<p><strong>Remarks:</strong></p>
<p>How to change the SQL Server or SQL Server Agent service account without using SQL Enterprise Manager in SQL Server 2000 or SQL Server Configuration Manager in SQL Server 2005:Â  <a href="http://support.microsoft.com/kb/283811" target="_blank">http://support.microsoft.com/kb/283811</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bahramov.com/2009/03/19/sql-web-assistant-could-not-open-the-output-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

