|
|
|
UDP Broadcaster
      
Group: General Forum Members
Last Login: Yesterday @ 6:34 AM
Points: 1,498,
Visits: 1,509
|
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Yesterday @ 5:16 PM
Points: 5,101,
Visits: 20,201
|
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: 2 days ago @ 1:07 PM
Points: 18,733,
Visits: 12,332
|
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Sunday, May 19, 2013 11:16 PM
Points: 1,061,
Visits: 1,151
|
|
Good basic question to start the week.....
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Monday, May 13, 2013 2:52 AM
Points: 366,
Visits: 131
|
|
The Statement has three GO syntax which indicates three Batches. Each Go used shows an end of the Batch. I have shown below each of the GO with their end of batches comments. But As per your question the statement should be executed in a single Batch in which case One has to remove all the GO syntax to execute the whole Query in a single Batch. And hence "Option 2 : All statement should fail" must be the right answer. The Error must be :-- Msg 2714, Level 16, State 1, Line 18 There is already an object named '#TempQoD' in the database.
Where as if you execute the whole statement with all GO syntax as it is .. In that case the Answer must be option 3.
-- Statement 1 Create Table #TempQoD ( RowId Integer , Question varChar(max) , Answer varChar(max) , PublishDate Date );
Go--End of first batch
-- Statement 2 Select 1 As [RowId] , 'True or False: The HAVING clause is the 4th phase of logical query processing?' As [Question] , 'True: 1-FROM, 2-WHERE, 3-GROUP BY, 4-HAVING, 5-SELECT, 6-ORDER BY.' As [Answer] , '15 Jan 2013' As [PublishDate] Into #TempQoD;
Go--End of 2nd Batch
-- Statement 3 Select * From #TempQoD;
Drop Table #TempQoD; GO--End Of third batch
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Saturday, May 18, 2013 6:46 PM
Points: 1,074,
Visits: 1,076
|
|
binod.soft (2/10/2013) The Statement has three GO syntax which indicates three Batches. Each Go used shows an end of the Batch. I have shown below each of the GO with their end of batches comments. But As per your question the statement should be executed in a single Batch in which case One has to remove all the GO syntax to execute the whole Query in a single Batch. And hence "Option 2 : All statement should fail" must be the right answer. The Error must be :-- Msg 2714, Level 16, State 1, Line 18 There is already an object named '#TempQoD' in the database.
Where as if you execute the whole statement with all GO syntax as it is .. In that case the Answer must be option 3.
-- Statement 1 Create Table #TempQoD ( RowId Integer , Question varChar(max) , Answer varChar(max) , PublishDate Date );
Go--End of first batch
-- Statement 2 Select 1 As [RowId] , 'True or False: The HAVING clause is the 4th phase of logical query processing?' As [Question] , 'True: 1-FROM, 2-WHERE, 3-GROUP BY, 4-HAVING, 5-SELECT, 6-ORDER BY.' As [Answer] , '15 Jan 2013' As [PublishDate] Into #TempQoD;
Go--End of 2nd Batch
-- Statement 3 Select * From #TempQoD;
Drop Table #TempQoD; GO--End Of third batch
Well, Let's not lost the question in the wordings; what's the point of three Go Statements , if the statement meant to remove them and then execute .. as it said
What will the outcome be after running all the following statements as 1 batch?
All the following statements, means Including Go ..
nice and simple , basics refreshed with a good question ... thanks for the question
~ demonfox ___________________________________________________________________ Wondering what I would do next , when I am done with this one
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Today @ 12:18 AM
Points: 152,
Visits: 155
|
|
nice question... starting with basic morning....
Manik You cannot get to the top by sitting on your bottom.
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Today @ 1:41 AM
Points: 3,189,
Visits: 4,147
|
|
binod.soft (2/10/2013)
remove all the GO syntax to execute the whole Query in a single Batch I agree with you. The wording of the question is totally misleading.
demonfox (2/10/2013)
All the following statements, means Including Go .. How about this: http://msdn.microsoft.com/en-us/library/ms188037.aspx
GO (Transact-SQL) Remarks GO is not a Transact-SQL statement So I read the question as following: 1) Do something to make the following statements to belong to one batch (ie, remove all GOs); 2) Run the resulting batch; 3) What will the outcome be?
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: Today @ 1:52 AM
Points: 9,371,
Visits: 6,469
|
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Saturday, May 18, 2013 6:46 PM
Points: 1,074,
Visits: 1,076
|
|
vk-kirov (2/10/2013)
GO (Transact-SQL) Remarks GO is not a Transact-SQL statement So I read the question as following: 1) Do something to make the following statements to belong to one batch (ie, remove all GOs); 2) Run the resulting batch; 3) What will the outcome be?
As you said all the wordings ; besides when it says statements then I understood it as the statements written to separate three statements ; and you understood that as T-Sql Statements :D
For me the question was more about the fact you can use Integer instead of int. Didn't know that
+1 I missed that :D
~ demonfox ___________________________________________________________________ Wondering what I would do next , when I am done with this one
|
|
|
|