Trying to show that a row has a child row
I have a table with an ID column, a parent ID column, and a foreign ID column so that some of the rows have child rows attached to them and each row is attached to a foreign key for grouping purposes....
View Articlepl/sql help required on insertion / updation of empid
My requirement is to insert data into emptable and fields - empid,empfname,emplname,empfilestatus,createdate. Based on the below criteria I need to insert data into emptable. For this purpose, am...
View Article'IF EXISTS(SELECT COUNT(1))' VS 'IF EXISTS(SELECT 1) '
Hi,I like to know which one from the below is better in performance when we check for the existence of rows.IF EXISTS(SELECT COUNT(1) FROM myTable)ORIF EXISTS(SELECT 1 FROM myTable)Please let me know...
View ArticleA sort of unpivot
Hi guys, I got this issue that I'm trying to resolve: having CREATE TABLE #TRY (idfcl int identity,, fcl int, datatry datetime, start int, endtry int, rate int) insert into #try values...
View Articleexecute an SP againest all linked servers
Experts,I have server 01 from where I linked 6 servers (total 7 servers including home server 01). Now I want to execute an SP against all the databases in all the 6 servers (and also the home server...
View ArticleWhat does SQL write to that allow changes to be undone or rolled back in case...
What does SQL write to that allow changes to be undone or rolled back in case of a system failure?
View ArticleUnion multiple tables dynamically based on lookuptable
Hi All,I have few table in my DB named info_1,info_2,info_3,info_4 and there is lookuptable named main_info.Main_info table containsID Startdate EndDate1 12/16/2013-00:00...
View ArticleSelect Statement to return elapse time and not data
Hi, I am running simple SQL Select queries against my database using a tool called SQuirreL (from Sourceforge). Some of the cases my queries return a lot of data which I am not interest in, I just...
View ArticleWhat component is included with Microsoft SQL Servers that can be used to...
What component is included with Microsoft SQL Servers that can be used to perform a broad range of data migration tasks?a.Full Text Search service b.SQL Notification Server c.SQL Reporting Server d....
View ArticleWhich statement would you use to confirm a transaction?
Which statement would you use to confirm a transaction?a.COMMIT TRANSACTIONb.ROLLBACK TRANSACTIONc.CHECK TRANSACTIONd. VIEW TRANSACTION
View ArticleOn a SQL server, what is eight 8 KB pages?
On a SQL server, what is eight 8 KB pages?a.extentb.heapc.filegroupd. file cluster
View ArticleWhat is a large set of disk managed by a high-performance controller that...
What is a large set of disk managed by a high-performance controller that presents a mount point to various servers across a private network?
View ArticleWhat area of memory does SQL user to help retrieve data pages from disk faster
What area of memory does SQL user to help retrieve data pages from disk faster
View ArticleHeap table vs clustered with added column
I have heap table with Primary Key composed of 2 columns. First column of PK is INT and second column is varchar(50).Currently, this PK is non-clustered index even if by default, sql creates PK as...
View ArticleQuery help - possibly RANK() over partition and Pivot (maybe not)
This is just a sample and is not the actual table and data. The table cannot be changed.I need to select all patients whose latest CareType = ‘Attending’ where the DrID = 1372 (Daffy Duck). The latest...
View ArticleOrder of precedence in where clause
Im getting an error on this statement:SELECT *FROM[My Table]WHEREISDATE([DATE OF BIRTH])= 1ANDCONVERT(DATETIME, [DATE OF BIRTH], 101)<'01/01/1899'Because its evaluating the second condition first...
View ArticleUsing CASE in the join statement in the AND clause. Where's the problem?
All,I have my code, where based on the case statement, I would like to restrict the number of records in my JOIN condition. It's the CASE statement that I have used, that's giving me the problem. Not...
View ArticleDifference in string comparisons between varchar and nvarchar
These statements were executed on SQL Server 2008 R2 Enterprise. Collation is the default SQL_Latin1_General_CP1_CI_AS.Any ideas why the difference in behavior?DECLARE @StringWithCharZero...
View ArticleGet months from a date range comparing event date
Hi All,Below is the dataCREATE TABLE #Coverage( EmployeeID INT, EmployeeName VARCHAR(20), CoverageName VARCHAR(50), CoverageAmount Decimal, CoveredBy VARCHAR(20), EventDate DATETIME, CoverageStartDate...
View ArticleMicrosoft TechNet Wiki TSQL Guru - Winners for November!!
The results for November's TechNet Guru competition have been posted!Sorry for the delay copying over to the forums, busy times...
View Article