.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> Sql Server >> Post New Question Subscribe to Interview Questions

Using query analyzer, name 3 ways to get an accurate count of the number of records in a table?

Posted By :Ghanashyam Nayak     Posted Date :December 23, 2010    Points :15   Category :Sql Server 
SELECT * FROM table1
SELECT COUNT(*) FROM table1
SELECT rows FROM sysindexes WHERE id = OBJECT_ID(table1) AND indid < 2

You can also find related Interview Question to Using query analyzer, name 3 ways to get an accurate count of the number of records in a table?  below: 

List the ways you can get total number of records in a table?

  
select count(*) from tablename
select rows from sysindexes where id=OBJECT_ID(tablename) and indid < 2
select * from tablename (More...)

Would the select query below fetch any records?



create table #testvm (ID int)

select * from sysobjects where name = '#testvm'

drop table #testvm

  
No..

Since temp tables are created in tempdb, and use a random name, the query will not work.

If you used a query like this, you would see your table:

select * from tempdb..sysobjects where name like '#testvm%' (More...)

How many ways return rows from one table not in another table?

  
There are at least 5 ways to return data from one table which is not in another table. Two of these are SQL Server 2005 and greater only

1)NOT IN

2)NOT EXISTS

3)LEFT and RIGHT JOIN

4)OUTER APPLY (2005+)

5)EXCEPT (2005+)

(More...)

How To retrive Duplicate Records when There is no Primary key in a Table?

  
select city_name
from areas
group by city_name

having count(*) > 1 (More...)

What Is Diffrence Between OSQL And Query Analyzer ?

  
Both are the same but ther eis little diffrence OSQL is command line tool whic is execute qery and display the result same a query analyzer but query analyzer is graphical and OSQL is a command line tool.OSQL have not ability like query analyzer to analyze queries and show statics on speed of execution and other usefull thing about OSQL is that its helps in scheduling. (More...)

In How many ways Data can be Export from Sql Table to Excel Sheet?

  
Some of these options include
1) Data Transformation Services (DTS),
2) SQL Server Integration Services (SSIS)
3) Bulk Copy (BCP)
4)OPENROWSET() (More...)

Write a SQL query to send mail, whenever a new record is inserted into a table using Sqlserver 2000.

  
Here we have to create a trigger on required table as show below.


CREATE TRIGGER SendRem
ON TableX
AFTER INSERT
AS

EXEC master..xp_sendmail
@recipients='you@you.com',
@message = 'body'
@subject = 'foo was fired.'
GO
(More...)

SQL Query to find the 4th highest Value in a Table.

  
Let us assume that we have Table with Student Name and Mark. We have to Find out 4th highest mark from here?


SELECT TOP 1 Mark FROM
(SELECT TOP 4 Mark FROM Student ORDER BY Mark DESC) AS E
ORDER BY Mark ASC
(More...)

Which command using Query Analyzer will give you the version of SQL server and operating system?

  
SELECT SERVERPROPERTY ('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition'). (More...)

How to get last five minuts records from Oracle Databse table?

  
select col_datetime,sysdate from tblname where trunc(col_datetime)=trunc(sysdate) and to_char(col_datetime,'dd-mm-yyyy hh24:mi:ss')>to_char(sysdate- interval '05' minute,'dd-mm-yyyy hh24:mi:ss')
(More...)

how to get records count by hourly wise?

  
SELECT Count (*), to_char(col_datetime,'yyyymmdd HH24') FROM tblname where Trunc(col_datetime) =Trunc(SYSDATE-1) group by to_char(col_datetime,'yyyymmdd HH24')
(More...)

If you 1Lakh records of employee in a table, then how will you get the 4th highest salary from the table?

  
SELECT TOP 1 * FROM [EmpTable] WHERE [salary] NOT IN (SELECT DISTINCT TOP 3 salary FROM [temp1] ORDER BY [salary] DESC) ORDER BY salary DESC (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend