SQL SERVER – 2008 – Interview Questions and Answers – Part 1

SQL Server Interview Questions and Answers
Print Book Available (207 Pages) | Sample Chapters

SQL SERVER – 2008 – Interview Questions and Answers Complete List Download

1) General Questions of SQL SERVER

What is RDBMS?

Relational Data Base Management Systems (RDBMS) are database management systems that maintain data records and indices in tables. Relationships may be created and maintained across and among the data and tables. In a relational database, relationships between data items are expressed by means of tables. Interdependencies among these tables are expressed by data values rather than by pointers. This allows a high degree of data independence. An RDBMS has the capability to recombine the data items from different files, providing powerful tools for data usage. (Read More Here)

What are the properties of the Relational tables?

Relational tables have six properties:

  • Values are atomic.
  • Column values are of the same kind.
  • Each row is unique.
  • The sequence of columns is insignificant.
  • The sequence of rows is insignificant.
  • Each column must have a unique name.

What is Normalization?

Database normalization is a data design and organization process applied to data structures based on rules that help building relational databases. In relational database design, the process of organizing data to minimize redundancy is called normalization. Normalization usually involves dividing a database into two or more tables and defining relationships between the tables. The objective is to isolate data so that additions, deletions, and modifications of a field can be made in just one table and then propagated through the rest of the database via the defined relationships.

What are different normalization forms?

1NF: Eliminate Repeating Groups

Make a separate table for each set of related attributes, and give each table a primary key. Each field contains at most one value from its attribute domain.

2NF: Eliminate Redundant Data

If an attribute depends on only part of a multi-valued key, remove it to a separate table.

3NF: Eliminate Columns Not Dependent On Key

If attributes do not contribute to a description of the key, remove them to a separate table. All attributes must be directly dependent on the primary key. (Read More Here)

BCNF: Boyce-Codd Normal Form

If there are non-trivial dependencies between candidate key attributes, separate them out into distinct tables.

4NF: Isolate Independent Multiple Relationships

No table may contain two or more 1:n or n:m relationships that are not directly related.

5NF: Isolate Semantically Related Multiple Relationships

There may be practical constrains on information that justify separating logically related many-to-many relationships.

ONF: Optimal Normal Form

A model limited to only simple (elemental) facts, as expressed in Object Role Model notation.

DKNF: Domain-Key Normal Form

A model free from all modification anomalies is said to be in DKNF.

Remember, these normalization guidelines are cumulative. For a database to be in 3NF, it must first fulfill all the criteria of a 2NF and 1NF database.

What is De-normalization?

De-normalization is the process of attempting to optimize the performance of a database by adding redundant data. It is sometimes necessary because current DBMSs implement the relational model poorly. A true relational DBMS would allow for a fully normalized database at the logical level, while providing physical storage of data that is tuned for high performance. De-normalization is a technique to move from higher to lower normal forms of database modeling in order to speed up database access.

What is Stored Procedure?

A stored procedure is a named group of SQL statements that have been previously created and stored in the server database. Stored procedures accept input parameters so that a single procedure can be used over the network by several clients using different input data. And when the procedure is modified, all clients automatically get the new version. Stored procedures reduce network traffic and improve performance. Stored procedures can be used to help ensure the integrity of the database.

e.g. sp_helpdb, sp_renamedb, sp_depends etc.

What is Trigger?

A trigger is a SQL procedure that initiates an action when an event (INSERT, DELETE or UPDATE) occurs. Triggers are stored in and managed by the DBMS. Triggers are used to maintain the referential integrity of data by changing the data in a systematic fashion. A trigger cannot be called or executed; DBMS automatically fires the trigger as a result of a data modification to the associated table. Triggers can be viewed as similar to stored procedures in that both consist of procedural logic that is stored at the database level. Stored procedures, however, are not event-drive and are not attached to a specific table as triggers are. Stored procedures are explicitly executed by invoking a CALL to the procedure while triggers are implicitly executed. In addition, triggers can also execute stored procedures.

Nested Trigger: A trigger can also contain INSERT, UPDATE and DELETE logic within itself, so when the trigger is fired because of data modification it can also cause another data modification, thereby firing another trigger. A trigger that contains data modification logic within itself is called a nested trigger. (Read More Here)

What is View?

A simple view can be thought of as a subset of a table. It can be used for retrieving data, as well as updating or deleting rows. Rows updated or deleted in the view are updated or deleted in the table the view was created with. It should also be noted that as data in the original table changes, so does data in the view, as views are the way to look at part of the original table. The results of using a view are not permanently stored in the database. The data accessed through a view is actually constructed using standard T-SQL select command and can come from one to many different base tables or even other views.

What is Index?

An index is a physical structure containing pointers to the data. Indices are created in an existing table to locate rows more quickly and efficiently. It is possible to create an index on one or more columns of a table, and each index is given a name. The users cannot see the indexes; they are just used to speed up queries. Effective indexes are one of the best ways to improve performance in a database application. A table scan happens when there is no index available to help a query. In a table scan SQL Server examines every row in the table to satisfy the query results. Table scans are sometimes unavoidable, but on large tables, scans have a terrific impact on performance.

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. With a linked server, you can create very clean, easy to follow, SQL statements that allow remote data to be retrieved, joined and combined with local data. Stored Procedure sp_addlinkedserver, sp_addlinkedsrvlogin will be used add new Linked Server. (Read More Here)

© Copyright 2000-2009 Pinal Dave. All Rights Reserved. SQLAuthority.com

Reference : Pinal Dave (http://blog.SQLAuthority.com)

239 thoughts on “SQL SERVER – 2008 – Interview Questions and Answers – Part 1

  1. Pingback: SQL SERVER - 2008 - Interview Questions and Answers Complete List Download Journey to SQL Authority with Pinal Dave

  2. Hi Dave

    This is satees kumar reddy. I am learing SQL Server 2005 from last 3 months, it is very interesting. Recently I found your website, it is very excellent to learn sql server. I am intersting to move as a DBA. Please tell me what i am going to do for that.


  3. Hi Dave,
    It’s quite a nice article!

    I want to argue about the index, you said here “An index is a physical structure containing pointers to the data”, but I think it is not exactly the case, for non-clustered index it is true, what if for clustered index? The clustered index should contain all data itself but not just a pointer, right?


  4. Hi All,

    I am priyanka. I prepaired for sql server developer cource.
    Now i want to attend interviews . So please help me for this . I need interview questions and answers from every toipic .
    And also i am preparing for certification exam so anyone knows any links please send me.



  5. Hi Sir/Madam

    I have one year of experience in SQL Server DBA.I want to give interviews.Can you send me updated interview questions on SQL Server on all version of SQL server.



  6. Relational tables have six properties:

    Values are atomic is one of them ,

    but i m not properly clear about atomic , what actually u mean by it here?


  7. Hi dev,

    ” I wish you very happy married life”

    site is really grate, i am feeling very lucky to have found such a nice site to learn sql server.

    I appreciate you for doing such a wonderful job.

    best regards,


  8. Hi,
    thank u so much.iam very happy to know that even such sites exists!!from here on i’ll visit ur page every day as a ritual.

    may god bless you..keep up the gud work..
    all the bst


  9. I had a MS SQL Database backed up .bak file which is of 22 GB and i have split it into 22 files of 1 GB each file with a splitter program.
    Is there a method to Restore each of these individually or say I only want to restore the first three files of 1 GB each into another MS sql server database.
    How can i do it ?


    • Hi Shilpa,

      Data integrity simply means the quality of data in the database.It is useful to keep the data unchanged and unique.Data integrity can be described in following scenarious

      •Entity integrity
      •Domain integrity
      •Referential integrity
      •User-defined integrity


      Partioned tables also best describable for data integrity and data management in the database.Parttioned tables help to keep certain set set of records to maintain as per our requirement.


  10. Shilpa –

    Data Integrity:
    This is many things to many people. It simply means the data you have stored in various tables can be trusted and is of high quality. How the trust can be defined is up to you – but basically it can be quantified as:

    Entity integrity means the presence of a unique row identifier, like Item_id which cannot be duplicated.

    Domain integrity – a range of values are allowed. Nothing more, nothing less.

    Referential integrity – establishing foreign keys will help you here.


    User defined integrity – well, you define it.

    UDF – is a user defined function, used to quickly (well depending on the quality of sql) do inline calculations/lookups inside a select statement. For example, you can write a udf that would check whether an Item number is valid, before you do any operations on it.

    Partitioned tables comes in handy when dealing with high volume tables. You take Table A that has say 25 million records with 5 million each for each of last five years and split them into TableA_2008 (that contains only 2008 data), TableA_@2007, TableA_2006 etc with proper indexes (there are some more details involved here that I am going to omit) etc, then create a view that will be called Table A that would be union of those 5 partitioned tables.

    When properly implemented, the performance gains are incredible, especially for reporting in Business Intelligence applications.

    Hope this helps.


        • I wonder if SQL Server at different organizations has limitations imposed by the hardware on which SQL Server is installed or the policies of an an organization. For example, I believe some SQL Server operations may fail with large data sets because temporary space is exhausted. Is this consistent with your experience and understanding?

          BTW, thank you for your blog. You are a special author because of your deep understanding of SQL Server technical topics as well as the clear and concise way that you communicate about those topics.


  11. Hi,

    Can you tell me how to copy the table contents from one server to another server.


    Server : server 1
    Database: db1
    Table : tb1

    Server : server2
    Database: db2
    Table : tb2

    i want to copy the tb1 data into tb2. Please help me?


  12. my name is krishna i am doing dotnet course……..and i have learnt sqlserver 2005…….and i find difficult to write storedprocedurs and triggers to improve on that what i want to do………


  13. Sir i am beginner in sqlserver 2005 ,i ve interest to learn lot of things what are the step that i want to follow,i want small tips for that sir


  14. sir, i have a doubt. that is the maximum number of coloumns in a table.
    if we dont specify the lenght of datatype what happens?


  15. Hi pinal,
    Great collection…just a small request..
    can i use these questions in my site…along with your reference and site url..?that would add value to my site..

    thanks in advance..


  16. Hello Sir,
    your articles are very nice and all
    me and my friend enjoing ur artical
    can u give me more logical interview questions on sql 2005 as i am going to appear for tester interviews……….


  17. Hello Sir.

    I want to get 100 rows from particular record and onward. in oracle i can use rownum and in mySql i have function limit … i want to know what is the ms-sql alternate for it.?

    I want to get 100 rows onward to one particular data … how can i ?


  18. Moderator: Please ignore previous comment.


    You need to use ROWCOUNT key word and set a value to this.

    Below is a sample example.

    /* This is original Table */
    declare @table table (id int identity , ename varchar(10))

    /* This is final table */
    declare @finaltable table (id int , ename varchar(10))

    declare @count int
    set @count = 1

    /* insert sample data of 20 records in original table */
    while @count 5

    /* This is your final result */
    select * from @finaltable

    /* This is how you limit no of rows to be effected */ — IMPORTANT
    set rowcount 10
    insert into @finaltable select * from @table where id > 5

    /* This is your final result */
    select * from @finaltable

    Let us know if this does not helps.
    ~ IM.


    • I use your code:

      /* This is original Table */
      declare @table table (id int identity , ename varchar(10))

      /* This is final table */
      declare @finaltable table (id int , ename varchar(10))

      declare @count int
      set @count = 1

      /* insert sample data of 20 records in original table */
      while @count = 5

      /* This is your final result */
      select * from @finaltable

      /* This is how you limit no of rows to be effected */ — IMPORTANT
      set rowcount 10
      insert into @finaltable select * from @table where id > 5

      /* This is your final result */
      select * from @finaltable

      –but this give output as like blank table
      –Can you help me how to show ?
      –How I insert sample data of 20 records in original table?
      –Please help me



  19. F.Y.I

    I also read recently in SQL 2008 books online that ROWCOUNT will not supported in the future versions of SQL Server. So please be careful when using it.

    Best regards,



  20. @Vipul : You mean ‘get 100 rows from particular TABLE not record’

    You can use the following syntax using TOP

    Select TOP 100 from Table

    TOP(100) might not work.



  21. @Prash: Thanks for the correction :)

    anyway, the works one for TOP syntax’s example (tested on SQL 2008) is like this:


    Note: ‘*’ means all rows available in that table, you can specify certain rows as required.


  22. Hi

    I am very much interested in become SQL programmer. And obtain MS certification. I have knowledge of programming C# and ASP.Net but not in the deep. Please let me how long it will take and how many hours I need to put in to this subject daily basis. Where I can find good materials. What are the all good methods follow. Is there big scope in this field??
    Sorry for all the questions. I thought this is the good place ask

    Thanks in advance


  23. Hello Sir, I want to develop a Gender database using SQL Server. And I want to know more in Normalizing. please send any Sample .
    Thank U .


  24. Hell sir,

    I want to copy table with same structure with different name in same database. I tried “Select * into ‘newtblname’ from ‘totblname’ but this will not copy foreign key constraints.
    Is there any other way to copy all structure.



  25. There is no place like your blog which clearly describes the concepts with examples. I love your site so much that i no more look anywher except your blog.. i wish you put more and more questions and be helpful for all self starters and learners.


  26. Hi Pinal Sir,

    I m bit confused.
    I m working as a Software Engineer. Currently working on VB and SQL Server. Basicall my work is in SQL Server, writing SP, triggers, backup restore. I m much more interested in SQL Server. I wana work Oracle or SQL Developer track.
    But i m not getting what to do next??
    Can u guide me little bit……..


  27. Practice…Practice…Practice…. This is the only way you can gain confidence on any programming language. I would recommend “Beginning SQL server 2005 programming” book. Don’t even miss single line. You should be good in 1 month. Seriously!


  28. Hi Pinal Dave,

    you are really great. I have got more solution related sql server. kindly provide me full information of BI. which type of job i can get after getting command on BI in sql server 2008. can i use all BI package in sql server 2008 express edition
    reply asap.

    thanks in advance
    sakendra kumar


  29. Hi Pinal Dave,

    Thank u so much .. Its very much usual for preparing interviews. I am having 1 year Exp in SQL , can u please send me some more interview qusetions ..

    Thanks a lot for ur wonderful Effort..

    Thanks ,


  30. Hi Pinal,
    I am preparing for sql server administration cource and simultaneously i want to attending interviews . So please help me for this . I need interview questions and answers from every toipic .
    can you plz send me the Q and Answers to my mail


  31. Hi Pinal,

    Thanks so much for the lovely article that you have posted. I am actually preparing for the MCTS in sql server 2005 and want your help and guidence. Please guide me through the process of preparation and also please tell me how will it benefit me in my current role in the company as a Dotnet developer .

    Many Thanks,



  32. Hi Pinal,

    In sql stored procedure i am using dynamic sql based on input parameters.

    But it is not showing any database fields in crystal report [using C#].

    So is there any way that i can get the output fields in stored prcedure & it can be displayed in database fields while creating crystal report in C#?

    Kindly guide me. I tried with lots of solutions but it doesn’t work, so please give one example.



    • Hi Riddhi,

      It’s not a matter that you are using dynamic procedure, matter is that first of all you create stored procedure and execute it into database it self. If it gives result on the basis of your parameter, after then go to crystal report->file->new blank report->create new connection->select OLE DB (ADO)->Microsoft OLE DB Provider fro SQL Server->click on Next Button->select server name->userid->password->database in which you have created stored procedure ->Next->Finish

      Now you have a tree available in left pan.
      you can select database ->dbo->stored procedure->select your stored and click on (>) button. now you have a window for parameter->after putting the value into parameter you click on OK button.

      after then go on View menu->Field Explorer->Click on database field->now your all field are available which your dynamic table returns.

      Since i haven’t your email id, so how it possible to display Print screen. If you have any further query. Keep in touch.

      Sakendar Kumar (MCA)


    • You can’t desing a report based on the procedure whose result is dynamic. If, based on the input parameters the number of columns can be changed, it is not possible to design a report.

      One option is to have as many procedures as possible for each combination of input values


  33. Dear Sir,

    I want to generate script of a table by command not by wizard facility.is there any command by which i can do this


    Preeti Agarwal


    • Hi Preeti,

      You can try following command to generate script

      C:\Program Files\Microsoft SQL Server\90\COM>tablediff.exe



  34. Hi Preeti agarwal,

    first of all you create my procedure
    and execute one by one like :-

    GenerateScript yourtablename

    If your problem are still not solved then keep in touch
    my email id:– [email removed for privacy and security purpose]

    Create Procedure GenerateScript (
    @tableName varchar(100))
    If exists (Select * from Information_Schema.COLUMNS where Table_Name= @tableName)
    declare @sql varchar(8000)
    declare @table varchar(100)
    declare @cols table (datatype varchar(50))
    insert into @cols values(‘bit’)
    insert into @cols values(‘binary’)
    insert into @cols values(‘bigint’)
    insert into @cols values(‘int’)
    insert into @cols values(‘float’)
    insert into @cols values(‘datetime’)
    insert into @cols values(‘text’)
    insert into @cols values(‘image’)
    insert into @cols values(‘uniqueidentifier’)
    insert into @cols values(‘smalldatetime’)
    insert into @cols values(‘tinyint’)
    insert into @cols values(‘smallint’)
    insert into @cols values(‘sql_variant’)

    set @sql=”
    Select @sql=@sql+
    case when charindex(‘(‘,@sql,1)<=0 then '(' else '' end +Column_Name + ' ' +Data_Type +
    case when Data_Type in (Select datatype from @cols) then '' else '(' end+
    case when data_type in ('real','money','decimal','numeric') then cast(isnull(numeric_precision,'') as varchar)+','+
    case when data_type in ('real','money','decimal','numeric') then cast(isnull(Numeric_Scale,'') as varchar) end
    when data_type in ('char','nvarchar','varchar','nchar') then cast(isnull(Character_Maximum_Length,'') as varchar) else '' end+
    case when Data_Type in (Select datatype from @cols)then '' else ')' end+
    case when Is_Nullable='No' then ' Not null,' else ' null,' end
    from Information_Schema.COLUMNS where Table_Name=@tableName

    select @table= 'Create table ' + table_Name from Information_Schema.COLUMNS where table_Name=@tableName
    select @sql=@table + substring(@sql,1,len(@sql)-1) +' )'
    select @sql as DDL



    Select 'The table '+@tableName + ' does not exist'


  35. hi,

    I am new in SQL, I am using SQL server 2005, I have one problem, the problem is the SA user password i have to reset after every 2-3 days. I donot want to reset after every few days. Anybody can help me regarding this.


    Sunil jangid
    [Edited phone number]


  36. hi,

    Please let me know, how to fix this problem. I am very fresher in SQL Server. because of this problem my developer is not able to connect with database. when i reset SA password. developer can easly connect with database.but i cannot reset password everytime. anybody can help me reagarding this.

    Sunil Jangid


  37. Hello Sunil,

    Is the password of “sa” user expiring repeatedly?
    If that is the issue then, please check the in the Properties page of “sa” login uncheck the following two checkboxes:
    Enforce Password policy
    Enforce Password expiration

    Pinal Dave


  38. Pingback: SQL SERVER – Interview Questions & Answers Needs Your Help Journey to SQL Authority with Pinal Dave

    • Hi sir i have .db data base file with with thousnds of data how can open that database. i tried more but it ll not come . i have tried in sql lite and ms acess it cant open.Its Showing error Its Not sql lite database.and in sqldbx its showing binary format


    • Sir, i have completed my BCA and i have decided to join the Dot net course. How is dot net course related to Sql server 2008 or DBA. what are the chances of getting the job if i simultaneously complete both the courses. Please help me regarding this matter. I am really confused


  39. Hi Pinal,

    I wanted to weather the INDEX of a table is removed from a table when we restore the databse.

    If it is removed then how do I REINDEX it again ?

    Please Help.


  40. Pinal

    You have done a great Job. Keep your good work going.
    We hardly see people like you in this self centric world.

    Kudos to your great work

    Warm regards,
    Ramesh Krishnamurthy


  41. I want display row to column and column to row in sql Table by sql-query.
    As Exampel:

    Name Roll
    AAAA 111
    BBBB 222

    I want to display in Following Format by SQL_QUERY

    Result Table:

    Name AAAA AAAA
    Roll 111 222



  42. Hi Pinal.

    Im working as junior level DBA in a production environment.Can i have a good article regarding performance tuning of SQL server.Also i want to know the importance of Dynamic management Views in performance of the sql server.I would like to appriciate the website and you as your efforts are worth than anything for us.Thanks in advance.


  43. Hi Pinal,

    Thanks so much for the lovely article that you have posted. I am actually preparing for the MCTS in sql server 2005 and want your help and guidence. Please guide me through the process of preparation and also please tell me how will it benefit me in my current role in the company as a Dotnet developer .


  44. Respected sir,
    my self zubair khan pursuing mca from ignou and working in cie Ltd company in last 3 years.as a Asstt IT executive.i also have knowledge of sql server7.0 and 2000.i want to make my speciliazation in database.i read ur interview question and answer it enough for IT company.i have T-sql programming skill. plz advice me sir


  45. Hi dave,

    I am having problems with learning the concepts of normalisation. Each time I find very difficult to normalise the given fields. Can you please share your experience on this. Or can you guide to some link where the normalisation is explained in detail with examples.

    Thanks & Best regards,
    kannan. R


    • I find it easier to think about normalization in the following way than to repeat mantras like “no redundant data”.

      Everything I work with are objects. Objects are serialized as records in the database tables. Object has properties. Properties are columns in the database. Object has relationships to other object. Relationships are indicated (and forced) with foreign keys in the database.

      Lastly, every object must be identifiable from other objects of same type.

      Take for instance object: human. Humans are identified by SSN (but don’t use SSN as primary key in the database!). SSN is one of the properties also. Other properties are like gender, name and age. Now you got already one table defined:


      INSERT INTO Human SELECT 1, ‘xxxxxx-xxx’, ‘Male’, ‘Marko Parkkola’, 33

      Humans usually live somewhere, let’s say in a house. House has properties like address. Now there’s another table:

      CREATE TABLE House(id INT PRIMARY KEY, Address VARCHAR(100))

      INSERT INTO House SELECT 1, ‘Tampere, Finland’
      INSERT INTO House SELECT 1, ‘Keitele, Finland’

      Now we have house but who to put our human in there? Simple, we need a relationship table that tells where human lives. But human can possess many houses and live only in one at the time? Alright, let’s put a property there which tells which kind of relationship human has to the house:

      CREATE TABLE Human_House(id INT PRIMARY KEY, HumanID INT NOT NULL, HouseID INT NOT NULL, RelationshipType VARCHAR(100))



      INSERT INTO Human_House SELECT 1, 1, 1, ‘Occupies’
      INSERT INTO Human_House SELECT 1, 1, 2, ‘Rents’

      Now examples are pretty lousy. Sorry about that. But I hope this helps, at least a bit.


  46. Hello Pinal sir,
    great collection , i liked …

    I am php developer and using mysql database(total 11 months exp . in mumbai).
    but i am not satisfly with this .

    so i want to change this to only database field.

    and i have confusion where to start to become dba and in which database technology (oracle, sql server , ibm db2)

    so kindly help me

    thanks in advance


  47. Hi, Pinal Sir
    I need to help, I was finished my Microsoft 2000, 2005, 2008 sql server dba tranning. Can you help me interview question and answer, and example of project. please


  48. hi,

    I am wokring in SQL server from 1.5 years..as eveloper and DBA now. If there is any job option, please let me know.

    Pinal, its always gr8 to learn from your site.

    [email address removed.]


  49. Hello sir,
    I am planning for a change so can you please provide me some interview questions on Sql server 2005 with some projects…and which book should i prefer?please let me know sir.



  50. i want to validate Uk number before inserting the table in sql itself.So i am trying cal a sql function which will return true if the number has been valid.If i am suppling number like 02071931271(uK number)the function should return its a valid number.I am bit confused how to proceed this.Kindly help me.
    thanks in advance.


  51. i want to validate Uk number before inserting the table in sql itself.So i am trying cal a sql function which will return true if the number has been valid.If i am suppling number like 02071931271(uK number)the function should return its a valid number.I am bit confused how to proceed this.Kindly help me.
    thanks in advance


  52. Do you know of any good dvds that will teach someone, who is not an IT person, MS SQL Server 2008. I want to change carreer and a friend of mine talked to me about learning SQL Server 2008. I read a lot of books, did a lot of practices in my computer, but I still think that i am not ready to start applying for a job.
    What is the least you to know to get a DBA Job.
    I know that you can never know everything, with experience and friction you get better at what you do.
    Just need some advise.
    Thank you.


  53. Hi Sir,

    May i please get interview questions on CLUSTERING and SQL SERVER 2008. This is very urgent and important to me. Please help me. Please post it on my mail.

    Ankesh Kumar


  54. Hi Pinal, your blog site is simply Out Standing!,I’m moving to DBA and your site has been very helpful, although i have a few questions that i’d like to ask. Is there a way to run 1 job for all databases? or selective in SQL Server 2008 R2?



    • hi,..
      i have just completed my B.C.A
      and i have done sql server 2005 in dba from niit.
      so i m looking job in data base plz suggest me few option.



  55. ihad completed my MCA.I learn the sqlserver and c#.net course.now i am searching job in software engenering. I want to know the data base like sql server.

    I want to know the all faq’s of SQL server and queries.pls send me the list of questions to my ID.


  56. hi i m working in telecom company as s.e. and i m working in sql server 2008 database ,i want know about sql developer,
    please send me sql developer interview questions and answers.


  57. Hi Pinal,

    I am asked this question frequently in my interviews.

    What kind of updates are found from sqlserver2005 to 2008?

    I tried different sites could not find all of them



  58. Sir, i have completed my BCA and i have decided to join the Dot net course. How is dot net course related to Sql server 2008 or DBA. what are the chances of getting the job if i simultaneously complete both the courses. Please help me regarding this matter. I am really confused


    • hi ,
      this is vijay bhatt from Udaipur ,
      need not to confuse it is jest a backend , u can also use
      Oracle , DB2 , Infomix etc.
      but now mostly compeny use Sql Server so u can learn easily
      , try to concentrate .net application .. Go on project ..
      Good Luck
      vijay bhatt


  59. Hi,

    Can you tell me how to copy the table contents from one server to another server.


    Server : server 1
    Database: db1
    Table : tb1

    Server : server2
    Database: db2
    Table : tb2

    i want to copy the tb1 data into tb2. Please help me?


  60. Sir

    i Prasanna dadhich haveing 2.6 year exp as DBA

    now a days i am looking another job

    but some are the question when the interviewee ask me i was confused please help

    1) how to reduse .ndf file size and where it is located

    2) why the ldf file size bigger than .mdf file

    3) what are the technical diff bet 2000 and 2005

    4) if master db is deleted what will happen and to recover it

    5) what are the disadvantage of sql 2005

    please reply

    waiting for that

    [email removed.]


  61. Hi Pinal,
    I have 2 server, one is installed sql 2008 another one is sql 2000,
    I have connected both with linked server, I can able to access from 2008 server to
    sql 2000 table but from sql 2000 server to sql 2008 is not
    working ..
    Iam getting error “General network error. Check your network documentation.”.
    can you help me to access from sql2000 to sql2008 db through linkedserver?

    Thanks in advance



  62. Hi Pinal,
    I am regular reader of your blog. I have a problem.

    I have a table name T1 having only one Column name Col1 having rows –





    And another table name T2 also having only one Column name Col1 having rows –





    Now I want record in following format-

    Col1 Col2
    a x

    b y

    c z
    This is my first question , I need it in very urgent basis. Please help sir…


    • Hello Kapil Dev Tripathi,

      You can add same types of primary keys (viz. PK) in both the tables (Just auto incremental value) and run some kind of query like:

      Select Table1.Col1, Table2.Col2
      FROM Table1 INNER JOIN Table2 ON Table1.PK = Table2.PK


      To Pinal : Keep up your great work !


  63. Hello Sir,

    i am really surprise when i got ur this site.

    pls send more SQL interview questions and answers

    Thanks & Regards

    Shahid Ansari


  64. hi,
    Thanks for the availability of the all interviwe quetion sir
    i am just biggener i want to read more and more in sql server
    commands and all relation ship

    thaks once agine


  65. I am writing one stored procedure which has parameter as well. I also need to some kind of programming logic as well. Here is my copy of stored procedure.
    I got an error that conversion failed while converting varchar to int datatype….I am using parameters and query in single quotation becasue of I am running some programming logic as well.

    What would be the error?


  66. I have a procedure which is performing merge(update/insert) , i would like to know how to add Exception handling where i can insert that error message in the table

    I’ve checked with Try..Catch , but am finding some problem … Can any one give an example for Exception handling in procedure


  67. Thanks Pinal for providing the so detailed information about the SQL.

    I am feraz ahmad , I have 6 years of experience in web development but I am enjoying more in the data base front. I want to pursue my career in the SQL DBA.
    Please suggest me correct path and where I can focus and achieve my goal.
    Thanks in advance.


    • Hi Geetha, Ram here, as u said that u r in training period on SQL SERVER 2008,bt best of my knowledge,no such institutes provides full in depth of training on domain,but the things they teach us will be usefull,n it will be fully depends upon u how u involve to learn the concepts, and requirements for this domain as a fresher it would be bit tougher but for 2+ experience it wrks out…..in hyderabad as well as in BANGlore n Chennai n pune..


  68. Hi Pinal..

    thanks in advance

    Could u say me how Many type of Triggers in Sql 2008 Like DDL trigger, Instead of Trigger, Before and After, like Wise



  69. hiiiiiiiiiiiiiii guyzzzzzzzzzzzzzzzzzzzzz?
    i have one doubt in sql that is
    in synonyms invalid cases r there.then i want to knw the wat is invalid case ?nd how many cases r there?at what situations r considered as invalid?


  70. @Gyanesh,

    You can use the designer to do this if u do not want to write the script.Just right click on the Tables in the object explorer under the required database and select New Table option and set the appropriate properties.

    if u want to create table with the same schema as one of the existing tables , then u can use SELECT clause for this.
    Ex : SELECT Col1,Col2 INTO New_Table_Name FROM Existing_Table_Name


  71. hi
    i have a table name employee ..where the columns are- emp_name,emp_dept,emp_desig,salary..
    now i want to see the department wise total salary and name of those employees whose sum of salary greater than 10000


  72. Please Help How to open .db file database. i have tried in sql 2005 and sqqldbx and ms acess it ll not come. please provide some information about that


  73. Hi penal,

    I liked your website.

    I am working in mnc. and my current role is release engineer. i need to do the website and ssrs script deployments. Can you pls suggest me what all concepts i need to focus for upcoming interviews.



  74. Hello,

    I am Mittal and I had a BS in Computer science degree and recently received certification in SQL SERVER. and because i dont have any experience it’ hard to find a job.. Is anyone know how i can start or what is the best things to do to start in SQL or is any training center that i can physically go and take training.

    Please let me know.

    Mittal P


  75. Hi People,

    I am Sagar, i am planning to change the current job. currenctly i am working as Prod MS SQL DBA, please can you send me some questions and answers realated to prod bda?

    Thanks in devance.



  76. Hi,
    can we insert a value in a table by store procedure by declaring the value datatype in exec SP ? and does SP returns a value type or reference type ?


  77. Nice information ……..just please advice me what is the good option for certification oracle 10g dba track or sql server 2008 which is the best………


  78. Pingback: SQL SERVER – Weekly Series – Memory Lane – #047 | Journey to SQL Authority with Pinal Dave

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s