<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Interview Questions and Answers &#8211; Frequently Asked Questions &#8211; Introduction &#8211; Day 1 of 31</title>
	<atom:link href="http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Thu, 23 May 2013 14:22:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: kamlesh</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-462820</link>
		<dc:creator><![CDATA[kamlesh]]></dc:creator>
		<pubDate>Wed, 24 Apr 2013 12:29:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-462820</guid>
		<description><![CDATA[exam question &amp;answer]]></description>
		<content:encoded><![CDATA[<p>exam question &amp;answer</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hamid</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-406144</link>
		<dc:creator><![CDATA[Hamid]]></dc:creator>
		<pubDate>Thu, 10 Jan 2013 18:29:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-406144</guid>
		<description><![CDATA[how to transfer table with data from one Sql server to other Sql server]]></description>
		<content:encoded><![CDATA[<p>how to transfer table with data from one Sql server to other Sql server</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harshit Raj Singh</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-404180</link>
		<dc:creator><![CDATA[Harshit Raj Singh]]></dc:creator>
		<pubDate>Sat, 05 Jan 2013 17:49:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-404180</guid>
		<description><![CDATA[JUST R8 CLICK ON DATA BASE --&gt; TASKS---&gt;CREATE BACKUP]]></description>
		<content:encoded><![CDATA[<p>JUST R8 CLICK ON DATA BASE &#8211;&gt; TASKS&#8212;&gt;CREATE BACKUP</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sonal</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-399378</link>
		<dc:creator><![CDATA[sonal]]></dc:creator>
		<pubDate>Wed, 26 Dec 2012 07:06:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-399378</guid>
		<description><![CDATA[can u please explain me how to save a database(it was asked in interview)
ans how to take the back up?]]></description>
		<content:encoded><![CDATA[<p>can u please explain me how to save a database(it was asked in interview)<br />
ans how to take the back up?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ronak Bagadia</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-389074</link>
		<dc:creator><![CDATA[Ronak Bagadia]]></dc:creator>
		<pubDate>Fri, 07 Dec 2012 19:17:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-389074</guid>
		<description><![CDATA[I am indebted to you for this blog and your sql pdf interview question answer file,in my small sql professional career of 2 yrs i followed your blog and pdfs and got a job offer.I am currently looking for a job again and i hope your pdf and my preparation will come to my rescue.Keep up the great work.]]></description>
		<content:encoded><![CDATA[<p>I am indebted to you for this blog and your sql pdf interview question answer file,in my small sql professional career of 2 yrs i followed your blog and pdfs and got a job offer.I am currently looking for a job again and i hope your pdf and my preparation will come to my rescue.Keep up the great work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shyam</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-382014</link>
		<dc:creator><![CDATA[shyam]]></dc:creator>
		<pubDate>Tue, 27 Nov 2012 13:09:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-382014</guid>
		<description><![CDATA[kevvu keka..............extrardinory Mr.pinal..............Awsome presentation....]]></description>
		<content:encoded><![CDATA[<p>kevvu keka&#8230;&#8230;&#8230;&#8230;..extrardinory Mr.pinal&#8230;&#8230;&#8230;&#8230;..Awsome presentation&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dilip Kumar</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-341964</link>
		<dc:creator><![CDATA[Dilip Kumar]]></dc:creator>
		<pubDate>Sat, 08 Sep 2012 08:40:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-341964</guid>
		<description><![CDATA[U have great research on this sql sever]]></description>
		<content:encoded><![CDATA[<p>U have great research on this sql sever</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DIPTI RANJAN DIKHIT</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-304403</link>
		<dc:creator><![CDATA[DIPTI RANJAN DIKHIT]]></dc:creator>
		<pubDate>Fri, 22 Jun 2012 17:16:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-304403</guid>
		<description><![CDATA[hay sir, 
            very nice.]]></description>
		<content:encoded><![CDATA[<p>hay sir,<br />
            very nice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rashmi</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-290444</link>
		<dc:creator><![CDATA[Rashmi]]></dc:creator>
		<pubDate>Tue, 29 May 2012 13:13:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-290444</guid>
		<description><![CDATA[Hi Pinal,
I have one image file (object) and want to use this single image in multiple crystal report or SSRS report. I want to store this image at one location and the reports will use that. Is it possible? How can we do this?]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,<br />
I have one image file (object) and want to use this single image in multiple crystal report or SSRS report. I want to store this image at one location and the reports will use that. Is it possible? How can we do this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: balaji</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-287371</link>
		<dc:creator><![CDATA[balaji]]></dc:creator>
		<pubDate>Wed, 23 May 2012 02:13:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-287371</guid>
		<description><![CDATA[Really Thanks for all these interview questions sir. Also does this posts contain the detailed answers that are their in the hard copy book? Please advise]]></description>
		<content:encoded><![CDATA[<p>Really Thanks for all these interview questions sir. Also does this posts contain the detailed answers that are their in the hard copy book? Please advise</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: KARTHIK</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-280009</link>
		<dc:creator><![CDATA[KARTHIK]]></dc:creator>
		<pubDate>Fri, 27 Apr 2012 07:01:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-280009</guid>
		<description><![CDATA[How to get abbreviation for a word?
For example : (word : Data Base Management System
abbr : DBMS)]]></description>
		<content:encoded><![CDATA[<p>How to get abbreviation for a word?<br />
For example : (word : Data Base Management System<br />
abbr : DBMS)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abdul Majid</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-275943</link>
		<dc:creator><![CDATA[Abdul Majid]]></dc:creator>
		<pubDate>Sat, 14 Apr 2012 05:30:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-275943</guid>
		<description><![CDATA[I NEED YOUR HELP
ANY IDEA ANY SOLUTION

SCENARIO:
	An organization suppose Jason industries have its branches in different regions of country. In each branch there is a local database where they maintain their data locally. Suppose one branch in New York, one in Washington, one in Texas. 
There is a main database in the main branch of the organization. At the end of each week or month each branch submits their data to the main database. I can say that they synchronize there data in the end of week or month. Note that each branch has its local database where data is kept in disconnected mode from main database. Only at end of each week or month the whole data of every branch is submitted to the main database..
My question is that is it possible? If yes, what this concept is called? And where from can I get help on this topic?]]></description>
		<content:encoded><![CDATA[<p>I NEED YOUR HELP<br />
ANY IDEA ANY SOLUTION</p>
<p>SCENARIO:<br />
	An organization suppose Jason industries have its branches in different regions of country. In each branch there is a local database where they maintain their data locally. Suppose one branch in New York, one in Washington, one in Texas.<br />
There is a main database in the main branch of the organization. At the end of each week or month each branch submits their data to the main database. I can say that they synchronize there data in the end of week or month. Note that each branch has its local database where data is kept in disconnected mode from main database. Only at end of each week or month the whole data of every branch is submitted to the main database..<br />
My question is that is it possible? If yes, what this concept is called? And where from can I get help on this topic?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sakshi chugh</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-272889</link>
		<dc:creator><![CDATA[sakshi chugh]]></dc:creator>
		<pubDate>Fri, 06 Apr 2012 10:51:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-272889</guid>
		<description><![CDATA[gud work!!!]]></description>
		<content:encoded><![CDATA[<p>gud work!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amit</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-250856</link>
		<dc:creator><![CDATA[Amit]]></dc:creator>
		<pubDate>Fri, 10 Feb 2012 07:48:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-250856</guid>
		<description><![CDATA[Pinal Dave you are great. !!!!!!!!!!!!!!!
You made it very easy for us to prepare Just keep it up..]]></description>
		<content:encoded><![CDATA[<p>Pinal Dave you are great. !!!!!!!!!!!!!!!<br />
You made it very easy for us to prepare Just keep it up..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul ndungu</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-208451</link>
		<dc:creator><![CDATA[Paul ndungu]]></dc:creator>
		<pubDate>Thu, 01 Dec 2011 06:36:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-208451</guid>
		<description><![CDATA[Pinal,

Great work

Continue the good work

I find your way of explaining SQL issue very simple up to the point

Do You know of any developer with knowledge in Retalix Storeline ver 8.7.3.28 ?

congratulations]]></description>
		<content:encoded><![CDATA[<p>Pinal,</p>
<p>Great work</p>
<p>Continue the good work</p>
<p>I find your way of explaining SQL issue very simple up to the point</p>
<p>Do You know of any developer with knowledge in Retalix Storeline ver 8.7.3.28 ?</p>
<p>congratulations</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: manish</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-186199</link>
		<dc:creator><![CDATA[manish]]></dc:creator>
		<pubDate>Tue, 01 Nov 2011 04:20:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-186199</guid>
		<description><![CDATA[As you&#039;r gave all interview question . that&#039;s the same way give us job 
                                 
                                                         if cross wrong than please forgive me 
                                                             manish]]></description>
		<content:encoded><![CDATA[<p>As you&#8217;r gave all interview question . that&#8217;s the same way give us job </p>
<p>                                                         if cross wrong than please forgive me<br />
                                                             manish</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Parvinder</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-165913</link>
		<dc:creator><![CDATA[Parvinder]]></dc:creator>
		<pubDate>Tue, 06 Sep 2011 08:23:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-165913</guid>
		<description><![CDATA[Great post, it is helpfull.]]></description>
		<content:encoded><![CDATA[<p>Great post, it is helpfull.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AG</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-153240</link>
		<dc:creator><![CDATA[AG]]></dc:creator>
		<pubDate>Wed, 03 Aug 2011 17:29:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-153240</guid>
		<description><![CDATA[gr8 stuff Pinal! Exactly what you promised in the introductory note on Day 1.. Helps both the interviewer and the interviewee..and a very speedy refresher for some must-know questions asked in SQL Server..thanks a ton!]]></description>
		<content:encoded><![CDATA[<p>gr8 stuff Pinal! Exactly what you promised in the introductory note on Day 1.. Helps both the interviewer and the interviewee..and a very speedy refresher for some must-know questions asked in SQL Server..thanks a ton!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER – The Difficult Interview Question – Moment of the Life – Day 31 of 31 Journey to SQLAuthority</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-152380</link>
		<dc:creator><![CDATA[SQL SERVER – The Difficult Interview Question – Moment of the Life – Day 31 of 31 Journey to SQLAuthority]]></dc:creator>
		<pubDate>Mon, 01 Aug 2011 17:19:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-152380</guid>
		<description><![CDATA[[...] read the Introductory Post before continue reading interview question and answers. Complete List of all the Interview [...]]]></description>
		<content:encoded><![CDATA[<p>[...] read the Introductory Post before continue reading interview question and answers. Complete List of all the Interview [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER – Interview Questions and Answers – Guest Post by Jacob Sebastian – Day 30 of 31 Journey to SQLAuthority</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-151704</link>
		<dc:creator><![CDATA[SQL SERVER – Interview Questions and Answers – Guest Post by Jacob Sebastian – Day 30 of 31 Journey to SQLAuthority]]></dc:creator>
		<pubDate>Sat, 30 Jul 2011 01:32:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-151704</guid>
		<description><![CDATA[[...] read the Introductory Post before continue reading interview question and [...]]]></description>
		<content:encoded><![CDATA[<p>[...] read the Introductory Post before continue reading interview question and [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER – Interview Questions and Answers – Guest Post by Feodor Georgiev – Day 29 of 31 Journey to SQLAuthority</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-151434</link>
		<dc:creator><![CDATA[SQL SERVER – Interview Questions and Answers – Guest Post by Feodor Georgiev – Day 29 of 31 Journey to SQLAuthority]]></dc:creator>
		<pubDate>Fri, 29 Jul 2011 01:31:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-151434</guid>
		<description><![CDATA[[...] read the Introductory Post before continue reading interview question and [...]]]></description>
		<content:encoded><![CDATA[<p>[...] read the Introductory Post before continue reading interview question and [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anil joshi</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-151031</link>
		<dc:creator><![CDATA[anil joshi]]></dc:creator>
		<pubDate>Wed, 27 Jul 2011 11:34:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-151031</guid>
		<description><![CDATA[Great one, but i have one question over here what about those interviewer who only want to listen which they know about the question, if you explain question according you they are not satisfied..]]></description>
		<content:encoded><![CDATA[<p>Great one, but i have one question over here what about those interviewer who only want to listen which they know about the question, if you explain question according you they are not satisfied..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER – Interview Questions and Answers – Guest Post by Rick Morelan – Day 27 of 31 Journey to SQLAuthority</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-150920</link>
		<dc:creator><![CDATA[SQL SERVER – Interview Questions and Answers – Guest Post by Rick Morelan – Day 27 of 31 Journey to SQLAuthority]]></dc:creator>
		<pubDate>Wed, 27 Jul 2011 01:31:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-150920</guid>
		<description><![CDATA[[...] read the Introductory Post before continue reading interview question and [...]]]></description>
		<content:encoded><![CDATA[<p>[...] read the Introductory Post before continue reading interview question and [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 1111</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-150873</link>
		<dc:creator><![CDATA[1111]]></dc:creator>
		<pubDate>Tue, 26 Jul 2011 20:28:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-150873</guid>
		<description><![CDATA[how to optimize this query..........please healp


USE [SD-DATALOADER]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Proc [dbo].[sp_InsertReceivedFileInfo] 
 @FileType varchar(100),
 @FileName varchar(100),
 @FacilityCode varchar(5)
As
Begin
      DECLARE @DtFile1 varchar(10)
      DECLARE @DtFile2 varchar(10)
                          SELECT @DtFile1=Convert(varchar,[FileDate],112) 
                    FROM [File Monitor](NOLOCK) 
                    WHERE FileType=@FileType and FacilityCode=@FacilityCode
                    and Received=&#039;N&#039; and DaysElapsed&gt;0
                    SET @DtFile2=left(@FileName,8)
              IF(@DtFile1 is not null)
              BEGIN
                          IF (@DtFile1=@DtFile2)
                          BEGIN
                          ----When Old file will received
              insert into [Daily Files] values(GETDATE(),@DtFile2,@FileType,@FileName,&#039;Y&#039;) 
                          END
                          ELSE
                          BEGIN
                          -- When Old Missing file is not received but New file for the current date is received
 IF  NOT EXISTS (SELECT 1 FROM [Daily Files](NOLOCK) WHERE CONVERT(VARCHAR,FILEDATE,112)=@DtFile1 AND FileType=@FileType AND Received=&#039;Y&#039;)
                             BEGIN
               insert into [Daily Files] values(GETDATE(),@DtFile1,@FileType,&#039;NULL&#039;,&#039;N&#039;) 
                               END
              insert into [Daily Files] values(GETDATE(),@DtFile2,@FileType,@FileName,&#039;Y&#039;) 
                            
                          END 
              END 
            ELSE
            BEGIN 
            insert into [Daily Files] values(getdate(),@DtFile2,@FileType,@FileName,&#039;Y&#039;)
            END    
End]]></description>
		<content:encoded><![CDATA[<p>how to optimize this query&#8230;&#8230;&#8230;.please healp</p>
<p>USE [SD-DATALOADER]<br />
GO<br />
SET ANSI_NULLS ON<br />
GO<br />
SET QUOTED_IDENTIFIER ON<br />
GO<br />
ALTER Proc [dbo].[sp_InsertReceivedFileInfo]<br />
 @FileType varchar(100),<br />
 @FileName varchar(100),<br />
 @FacilityCode varchar(5)<br />
As<br />
Begin<br />
      DECLARE @DtFile1 varchar(10)<br />
      DECLARE @DtFile2 varchar(10)<br />
                          SELECT @DtFile1=Convert(varchar,[FileDate],112)<br />
                    FROM [File Monitor](NOLOCK)<br />
                    WHERE FileType=@FileType and FacilityCode=@FacilityCode<br />
                    and Received=&#8217;N&#8217; and DaysElapsed&gt;0<br />
                    SET @DtFile2=left(@FileName,8)<br />
              IF(@DtFile1 is not null)<br />
              BEGIN<br />
                          IF (@DtFile1=@DtFile2)<br />
                          BEGIN<br />
                          &#8212;-When Old file will received<br />
              insert into [Daily Files] values(GETDATE(),@DtFile2,@FileType,@FileName,&#8217;Y')<br />
                          END<br />
                          ELSE<br />
                          BEGIN<br />
                          &#8212; When Old Missing file is not received but New file for the current date is received<br />
 IF  NOT EXISTS (SELECT 1 FROM [Daily Files](NOLOCK) WHERE CONVERT(VARCHAR,FILEDATE,112)=@DtFile1 AND FileType=@FileType AND Received=&#8217;Y')<br />
                             BEGIN<br />
               insert into [Daily Files] values(GETDATE(),@DtFile1,@FileType,&#8217;NULL&#8217;,'N&#8217;)<br />
                               END<br />
              insert into [Daily Files] values(GETDATE(),@DtFile2,@FileType,@FileName,&#8217;Y') </p>
<p>                          END<br />
              END<br />
            ELSE<br />
            BEGIN<br />
            insert into [Daily Files] values(getdate(),@DtFile2,@FileType,@FileName,&#8217;Y')<br />
            END<br />
End</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 1111</title>
		<link>http://blog.sqlauthority.com/2011/07/01/sql-server-interview-questions-and-answers-frequently-asked-questions-introduction-day-1-of-31/#comment-150870</link>
		<dc:creator><![CDATA[1111]]></dc:creator>
		<pubDate>Tue, 26 Jul 2011 20:24:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13259#comment-150870</guid>
		<description><![CDATA[how to optimize this query..........please healp


USE [SD-DATALOADER]
GO
/****** Object:  StoredProcedure [dbo].[sp_InsertReceivedFileInfo]    Script Date: 07/26/2011 17:17:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Proc [dbo].[sp_InsertReceivedFileInfo] 
---------------------Created By: Shriman Narayan Pandey-------------------------------
---------------------Dated: 25Th July 2011--------------------------------------------
 @FileType varchar(100),
 @FileName varchar(100),
 @FacilityCode varchar(5)
As
Begin
      DECLARE @DtFile1 varchar(10)
      DECLARE @DtFile2 varchar(10)
                          SELECT @DtFile1=Convert(varchar,[FileDate],112) 
                    FROM [File Monitor](NOLOCK) 
                    WHERE FileType=@FileType and FacilityCode=@FacilityCode
                    and Received=&#039;N&#039; and DaysElapsed&gt;0
                    SET @DtFile2=left(@FileName,8)
              IF(@DtFile1 is not null)
              BEGIN
                          IF (@DtFile1=@DtFile2)
                          BEGIN
                          ----When Old file will received
              insert into [Daily Files] values(GETDATE(),@DtFile2,@FileType,@FileName,&#039;Y&#039;) 
                          END
                          ELSE
                          BEGIN
                          -- When Old Missing file is not received but New file for the current date is received
 IF  NOT EXISTS (SELECT 1 FROM [Daily Files](NOLOCK) WHERE CONVERT(VARCHAR,FILEDATE,112)=@DtFile1 AND FileType=@FileType AND Received=&#039;Y&#039;)
                             BEGIN
               insert into [Daily Files] values(GETDATE(),@DtFile1,@FileType,&#039;NULL&#039;,&#039;N&#039;) 
                               END
              insert into [Daily Files] values(GETDATE(),@DtFile2,@FileType,@FileName,&#039;Y&#039;) 
                            
                          END 
              END 
            ELSE
            BEGIN 
            insert into [Daily Files] values(getdate(),@DtFile2,@FileType,@FileName,&#039;Y&#039;)
            END    
End]]></description>
		<content:encoded><![CDATA[<p>how to optimize this query&#8230;&#8230;&#8230;.please healp</p>
<p>USE [SD-DATALOADER]<br />
GO<br />
/****** Object:  StoredProcedure [dbo].[sp_InsertReceivedFileInfo]    Script Date: 07/26/2011 17:17:08 ******/<br />
SET ANSI_NULLS ON<br />
GO<br />
SET QUOTED_IDENTIFIER ON<br />
GO<br />
ALTER Proc [dbo].[sp_InsertReceivedFileInfo]<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;Created By: Shriman Narayan Pandey&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;Dated: 25Th July 2011&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
 @FileType varchar(100),<br />
 @FileName varchar(100),<br />
 @FacilityCode varchar(5)<br />
As<br />
Begin<br />
      DECLARE @DtFile1 varchar(10)<br />
      DECLARE @DtFile2 varchar(10)<br />
                          SELECT @DtFile1=Convert(varchar,[FileDate],112)<br />
                    FROM [File Monitor](NOLOCK)<br />
                    WHERE FileType=@FileType and FacilityCode=@FacilityCode<br />
                    and Received=&#8217;N&#8217; and DaysElapsed&gt;0<br />
                    SET @DtFile2=left(@FileName,8)<br />
              IF(@DtFile1 is not null)<br />
              BEGIN<br />
                          IF (@DtFile1=@DtFile2)<br />
                          BEGIN<br />
                          &#8212;-When Old file will received<br />
              insert into [Daily Files] values(GETDATE(),@DtFile2,@FileType,@FileName,&#8217;Y')<br />
                          END<br />
                          ELSE<br />
                          BEGIN<br />
                          &#8212; When Old Missing file is not received but New file for the current date is received<br />
 IF  NOT EXISTS (SELECT 1 FROM [Daily Files](NOLOCK) WHERE CONVERT(VARCHAR,FILEDATE,112)=@DtFile1 AND FileType=@FileType AND Received=&#8217;Y')<br />
                             BEGIN<br />
               insert into [Daily Files] values(GETDATE(),@DtFile1,@FileType,&#8217;NULL&#8217;,'N&#8217;)<br />
                               END<br />
              insert into [Daily Files] values(GETDATE(),@DtFile2,@FileType,@FileName,&#8217;Y') </p>
<p>                          END<br />
              END<br />
            ELSE<br />
            BEGIN<br />
            insert into [Daily Files] values(getdate(),@DtFile2,@FileType,@FileName,&#8217;Y')<br />
            END<br />
End</p>
]]></content:encoded>
	</item>
</channel>
</rss>
