Interview is very important event for any person. A good interview leads to good career if candidate is willing to learn. I always enjoy interview questions and answers series. This is my very humble attempt to write SQL Server 2008 interview questions and answers. SQL Server is very large subject and not everything is usually asked in interview. In interview what matters the most is conceptual knowledge and learning attitude.

I have listed all the series in this post so that it can be easily downloaded and used. All the questions are collected and listed in one PDF which is here to download. If you have any question or if you want to add to any of the question please send me mail or write a comment.

I have to design a script which would go thru the DB and extract a flat file of each pertinent table’s data(1 file/table).I have used DTS to export data from databases.I have never written a script for extraction.Could you please guide me on this and help me in getting started on how to write a script with a small example.Could you also please help me on how to run the script against the database so that it could generate a data file

thanks a lot,……i think no book will give as much wealthy knowledge as your website gives…..this is the real place to learn a lot and that too your examples are amazing…..easy to understand and learn……..thanks a lot.

The information there on this blog is very useful & helpful thanks for providing such informative infromation.

Sir i have a query in ms-sql server2000
can we convert numeric(18,0) to identity(1,1) which will be primary key ,
since this ID numeric(18,0) is a foreign key in another table so i wanted that this key should be as primary auto incrementing key

whereas i am also unable to do insert into statement for the same
error ocuuring is as : Cannot insert explicit value for identity column in table

Im Sudha..i found ur site today when i was searching for sql server material….My doubt is i want to take sql server 2008 certification..could you plz tell me which is best i mean sql server 2005 r 2008 i didnt take any exam so which is best i mean

I am getting this kind of error. during the installation i didnt give any login name and password . so what to enter here as login name i dont know.i tried some of them ur solution still give me same error. My Os is window vista and if i try to see service from computer management does not give me service of sql server.

please help me out.

TITLE: Connect to Server
——————————

Cannot connect to 76.194.236.194.

——————————
ADDITIONAL INFORMATION:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 3)

i want to build my career in database.
could u tell me for which certification should i go?
i mean ORACLE or SQL2008.
someone told me that sqlserver2008 will be the best. i m getting confused. pls suggest me.
I m pursuing MCA final year from regular.

I have written the query in MDX Query Editor in SOL Server 2008 Successfully,
But the problem is when we implement the same query in Cube(as expression in calculated measure) its not working in SSAS 2008

Dave, i take issue with this statement: “Identity/GUID columns do not need to be indexed.” I will agree the statement is correct IF YOU NEVER USE THE COLUMN (but then i would submit the column exists for no valid reason, and that’s a different discussion).

Often, the identity column is used as a surrogate primary key (and very often because the table designer was too lazy to figure out what data element(s) uniquely identify the row — again, a different discussion).

If the identity column is used as a primary key in this table, and then as a foreign key in other tables, the identity column must ABSOLUTELY be indexed (unless the table is so small that it is always in memory… or unless you enjoy table scans).

there is no automatic creation of an index on an identity column, and there is no automatic clustering of data based upon that identity column.

We are considering to migrate from SQL Server 2000 to 2008. I think the version 2008 should be backward compatible.

Would like to check is there any changes like those command being used in 2000 could not be used (not supported) in the version 2008? as I overheard in the past where some of the version 2000 cmd no longer applicable in version 2008.

Actually, I am .NET developer. But most of the compnies requires that we have strong knowledge of SQL too. You article helped a lot.

One thing I want to share with you. Some of my friends gave interview in Patni Computers, Gandhinagar for .NET. They were asking questions about SQL only (for .NET positions). They were asking question of Database administrator level (Database mirroring, SSIS, DTS packages etc.) Do you think, all .NET developer should have DB Admin level of SQL knowledge?

please check if you can help about the below topic
This is just an interview question i got from one of interviewer. for which I did not knew answer.
Any insight on this welcome..

If we have dimension tables loaded and used surrogate keys for processing. Now what happens is the we loaded fact table too. What happens if the dimension tables gets corrupted and we do not have any backup of the dimension tables. So will the fact table still funstional and will give us correct results. Is there any we can get out dimension tables back from the fact table (keep in mind there is surrogate key used).
Do we need to rebuild the fact table by rebuilding the dimension table. Will it cost much time reuilding fact table. Is there any approach besides this.

I created a publication using sql 2008 serve. the publication was deleted. I want to know if there is a way to discover the computer that connected to the server and deleted this publication. Any Help?

“Without or Outside Transactions”, When DELETE/TRUNCATE is applied outside the transaction the changes are committed as soon as you execute sql statements. Thus nor DELETE neither TRUNCATE can be rollbacked. Thus in order to retrieve DELETED/TRUNCATED records you have to restore the last backup and run the transaction logs until the time DELETE/TRUNCATION happened.

Hi Sir,
I have done mcom i was working as mis reporting in excel , company got relocated i was in search of job someone suggested me do course in oracle DBA …I finished my course can u suggest me how shld i study… and prepare for interview and pls send me interview question to my mail id….pls i am physically challenge girl i am struggle to find job…

Great work, good basic set of questions. It is great that I can download them. I can see preventing the changing of the document, but preventing the printing is a little overboard. if I can download, why cant I print?
I use your questions a a reference point to what topics I really want to touch on during an interview. I do not always have a computer nearby.

I am using SQL SERVER 2008 R2. In that i was created the job for taking the back up. It was working from the day of it is created. But from the last week it was not executed and also it shows error” Execution Failed.,See the Maintanence Plan and SQL Server Agent Job History logs for details”

Please let me know why it happens? What is the solution to resolve this?

This is good for fresh people who just learn sql server and want to job as developer.
But pinal , I am looking for some technical interview question with answer and some technical example as well.
Because in some job people take interview with situation , action and result.
I am looking that kind of interview question and answer.

where cd.documentname not like ‘%Phone%’
and cv.clientdisplayname not like ‘TEST%’
and cd.documentname like ‘%Rapid%’
and dateadd(dd, datediff(dd, 0, cd.ArrivalDtm ), 0) <= dateadd(dd, datediff(dd, 0, GETDATE()), 0)
and cd.ArrivalDtm between @FromDate and @ToDate

Hi all.this is just a great blog for sql. my question is this:
1. Write a database script that would achieve the following:
a. A DB Schema for a banking scenario that serves clients with both loans and savings. (use back page)

b. Database stored procedures to insert and/or update the database tables. (use back page)
how can i be able to do this

Hi Mr Pinal,
I have monitored your blog for quite some time and I am to oblige to say thank you for the good work. After several attempts I am still unable to download or find your books on MSSQL interview questions and answers. All the links are pointing in the locations and nothing is available to download. Can you please urgently help as I have a number of interview lined up and you are the only one who could truly help with the online (PDF) format of the interview questions and answers. Please reply to email.

Community Initiatives

About Pinal Dave

Pinal Dave is a Pluralsight Developer Evangelist. He has authored 11 SQL Server database books, 17 Pluralsight courses and have written over 3200 articles on the database technology on his blog at a http://blog.sqlauthority.com. Along with 11+ years of hands on experience he holds a Masters of Science degree and a number of certifications, including MCTS, MCDBA and MCAD (.NET). His past work experiences include Technology Evangelist at Microsoft and Sr. Consultant at SolidQ. Follow @pinaldave
Send Author Pinal Dave
an email at pinal@sqlauthority.com

Email Subscription

Enter your email address to subscribe to this blog and receive notifications of new posts by email.