To Read Error Log, we can use xp_readerrorlog, which is a external SP.
see the following code, it let us know, how to use this SP
This extended stored procedure will return a errorlog file.
EXEC master..xp_readerrorlog
EXEC master..xp_readerrorlog
USE pubs
GO
SELECT au_lname, au_fname
FROM authors WHERE city = ANY (SELECT city FROM publishers)
GO
This following Query Explains, How to use Exists in SQL Query.
Have a look at the sample given below
USE pubs
GO
SELECT au_lname, au_fname FROM authors
WHERE exists
(SELECT * FROM publishers WHERE authors.city = publishers.city)
GO
When a subquery is introduced with the keyword EXISTS, it functions as an existence test. The WHERE clause of the outer query tests for the existence of rows returned by the subquery. The subquery does not actually produce any data; it returns a value of TRUE or FALSE.
This code sample shows how to list all Tables and its data Rows count
SELECT
o.name TableName ,
i.rows TblRowCount
FROM
sysobjects o INNER JOIN sysindexes i ON (o.id = i.id)
WHERE
o.xtype = 'u' AND i.indid < 2