<?xml version="1.0" encoding="UTF-8"?><rss version="0.91" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><copyright>All content (copyright) respective authors</copyright><description>vmonpara's code bookmark tagged with sql server</description><link>http://www.codaddict.com/vmonpara/sql server</link><title>vmonpara's code bookmark tagged with sql server</title><item><title>Attach/Detach database using osql</title><description>exec sp_attach_db @dbname = 'Portal', @filename1 ='C:\Program Files\Microsoft SQL Server\MSSQL$VISHAL\Data\Portal.mdf', @filename2 ='C:\Program Files\Microsoft SQL Server\MSSQL$VISHAL\Data\Portal_log.LDF'<br />
go<br />
<br />
exec sp_detach_db 'Portal'<br />
go</description><link>http://www.codaddict.com/vmonpara/SQL Server</link><dc:creator>vmonpara</dc:creator><pubDate>Sat, 29 Dec 2007 11:33:32 GMT</pubDate></item><item><title>Get all nodes from SQL Server cluster</title><description>SELECT * FROM sys.dm_os_cluster_nodes</description><link>http://www.codaddict.com/vmonpara/SQL Server</link><dc:creator>vmonpara</dc:creator><pubDate>Wed, 19 Dec 2007 10:17:09 GMT</pubDate></item><item><title>Get active node from SQL Server cluster</title><description>SELECT SERVERPROPERTY('ComputerNamePhysicalNetBIOS') ActiveNode</description><link>http://www.codaddict.com/vmonpara/SQL Server</link><dc:creator>vmonpara</dc:creator><pubDate>Wed, 19 Dec 2007 10:13:48 GMT</pubDate></item><item><title>SQL Server Case Statement syntax</title><description>SELECT title, price,<br />
        Budget = CASE price<br />
         WHEN price &gt; 20.00 THEN 'Expensive'<br />
          WHEN price BETWEEN 10.00 AND 19.99 THEN 'Moderate'<br />
          WHEN price &lt; 10.00 THEN 'Inexpensive'<br />
          ELSE 'Unknown'<br />
        END,<br />
FROM titles</description><link>http://www.codaddict.com/vmonpara/SQL Server</link><dc:creator>vmonpara</dc:creator><pubDate>Tue, 14 Aug 2007 04:37:50 GMT</pubDate></item><item><title>DTS Error: Object not a collection</title><description>Instead of DTSGlobalVarialbes(&quot;gVar&quot;), put DTSGlobalVarialbes(&quot;gVar&quot;).Value</description><link>http://www.codaddict.com/vmonpara/SQL Server</link><dc:creator>vmonpara</dc:creator><pubDate>Mon, 13 Aug 2007 03:34:02 GMT</pubDate></item><item><title>Give permission to SQL Server DB user using command line</title><description>osql -E -S &quot;mycomputer\instance&quot; -Q &quot;sp_grantlogin 'mycomputer\ASPNET'&quot;<br />
osql -E -S &quot;mycomputer\instance&quot; -d dbname -Q &quot;sp_grantdbaccess 'mycomputer\ASPNET'&quot;<br />
osql -E -S &quot;mycomputer\instance&quot; -d dbname -Q &quot;sp_addrolemember 'db_owner', 'mycomputer\ASPNET'&quot;</description><link>http://www.codaddict.com/vmonpara/SQL Server</link><dc:creator>vmonpara</dc:creator><pubDate>Mon, 13 Aug 2007 03:29:41 GMT</pubDate></item><item><title>DTS SQL Statement / Stored procedure / Function to check for existence of file.</title><description>CREATE FUNCTION [dbo].[fn_FileExists] (@FileName nvarchar(255))<br />
RETURNS bit AS  <br />
BEGIN <br />
	DECLARE @FS int<br />
	DECLARE @FileID int<br />
	DECLARE @OLEResult int<br />
	declare @Exists bit<br />
	<br />
	EXECUTE @OLEResult = sp_OACreate 'Scripting.FileSystemObject', @FS OUT<br />
	IF @OLEResult &lt;&gt; 0<br />
	BEGIN<br />
		RETURN 0<br />
	END<br />
	<br />
	EXECUTE @OLEResult = sp_OAMethod @FS, 'FileExists', @Exists OUT, @FileName<br />
	<br />
	IF @OLEResult &lt;&gt; 0<br />
	BEGIN<br />
		return 0<br />
	END<br />
	EXECUTE @OLEResult = sp_OADestroy @FS<br />
	<br />
	return @Exists<br />
<br />
END</description><link>http://www.codaddict.com/vmonpara/SQL Server</link><dc:creator>vmonpara</dc:creator><pubDate>Sun, 12 Aug 2007 08:16:31 GMT</pubDate></item><item><title>Stop DTS Package Execution Conditionally Without Failure</title><description>Dim fso, file1<br />
Dim pkg<br />
SET pkg = DTSGlobalVariables.Parent<br />
<br />
Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)<br />
<br />
IF (fso.FileExists(&quot;c:\abc.txt&quot;)) THEN<br />
	Msgbox &quot;File exist. Continue&quot;<br />
	pkg.Steps(&quot;DTSStep_DTSActiveScriptTask_2&quot;).DisableStep=False<br />
	<br />
	Set fso= Nothing<br />
	<br />
ELSE<br />
	Msgbox &quot;Stop&quot;<br />
	pkg.Steps(&quot;DTSStep_DTSActiveScriptTask_2&quot;).DisableStep=True <br />
END IF<br />
set pkg=nothing<br />
Main = DTSTaskExecResult_Success</description><link>http://www.codaddict.com/vmonpara/SQL Server</link><dc:creator>vmonpara</dc:creator><pubDate>Sun, 12 Aug 2007 08:14:11 GMT</pubDate></item></channel></rss>