expierenced interview questions for MS-sql server

Posted by balajirnaukri-12656 under Sql Server on 4/23/2012 | Points: 10 | Views : 4573 | Status : [Member] | Replies : 4
Hi all,

I need scenario oriented interview questions for experienced persons in MS-sql server.ie They will be asking the query to find the average sales of the company like those.Can anyone post those kind of question.I am not able to find anything related to it.

Thanks and Regards
Balaji.R
ASP.NET Devloper
Solve-IT corp



Responses

Posted by: Pandians on: 4/23/2012 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi

#1: You have been given the following table structure with data.

Table Name : Table1

Id	Name	Place

--- ---- ------
NULL A Bihar
NULL B Patna
NULL C Purnia
NULL D Kolkatta
NULL E Mumbai
NULL F Chennai
- How to Update Sequence Number for the above records ?(IDENTITY is not required)

Condition : 1.Loop should not be used 2) CTE also should not be used

Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

balajirnaukri-12656, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jasminej on: 4/24/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

I want to know the Answer.. Kindly post the answer Please

Thanks You

balajirnaukri-12656, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pandians on: 4/25/2012 [Member] [MVP] Silver | Points: 25

Up
0
Down
#1 - Answer
Declare @Seq Int

Select @Seq = 0
Update Table1 Set ID = @Seq, @Seq = @Seq + 1
Go


Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

balajirnaukri-12656, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jasminej on: 4/25/2012 [Member] Starter | Points: 25

Up
0
Down
Thank You Pandians!

balajirnaukri-12656, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response