SQL SERVER Interview Questions-part6



  1. Which TCP/IP port does SQL Server run on?
    SQL Server runs on port 1433 but we can also change it for better security.
  2. From where can you change the default port?
    From the Network Utility TCP/IP properties �> Port number.both on client and the server.
  3. Can we use Truncate command on a table which is referenced by FOREIGN KEY?
    No. We cannot use Truncate command on a table with Foreign Key because of referential integrity.
  4. What is the use of DBCC commands?
    DBCC stands for database consistency checker. We use these commands to check the consistency of the databases, i.e., maintenance, validation task and status checks.
  5. What command do we use to rename a db?
    sp_renamedb â€Ë?oldname’ , â€Ë?newname’
  6. Sometimes sp_reanmedb may not work you know because if some one is using the db it will not accept this command so what do you think you can do in such cases?
    In such cases we can first bring to db to single user using sp_dboptions and then we can rename that db and then we can rerun the sp_dboptions command to remove the single user mode. 
  7. What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?
    Having Clause is basically used only with the GROUP BY function in a query. WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.
  8. What do you mean by COLLATION?
    Collation is basically the sort order. There are three types of sort order Dictionary case sensitive, Dictonary - case insensitive and Binary.
  9. When do you use SQL Profiler?
    SQL Profiler utility allows us to basically track connections to the SQL Server and also determine activities such as which SQL Scripts are running, failed jobs etc..
  10. What is a Linked Server?
    Linked Servers is a concept in SQL Server by which we can add other SQL Server to a Group and query both the SQL Server dbs using T-SQL Statements.