|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 1:34 AM
Points: 1,370,
Visits: 453
|
|
Comments posted to this topic are about the item sys.syscomments
----------------- Gobikannan
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Yesterday @ 1:07 PM
Points: 18,733,
Visits: 12,332
|
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Today @ 12:54 AM
Points: 1,969,
Visits: 1,820
|
|
| I disagree: the query returns all rows that contains the word 'order' in the column [text] that may appear in comments or definition.
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Monday, March 25, 2013 4:03 AM
Points: 850,
Visits: 71
|
|
Good Question! Keep questioning................
Regards, Jagan.
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: Yesterday @ 9:06 AM
Points: 9,367,
Visits: 6,465
|
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 3:44 PM
Points: 1,786,
Visits: 3,323
|
|
I think the answer is wrong. "All of the above" should be correct. Let's look at the three first options.
1. "Retrieves the name of stored procedures which consists the text 'order' in the definition."
2. "Retrieves the name of view, rule, default, trigger, CHECK constraint, DEFAULT constraint, and stored procedures which consists the text 'order' in the comments."
3. "Retrieves the name of view, rule, default, trigger, CHECK constraint, DEFAULT constraint, and stored procedures which consists of the text 'order' in the definition."
Nowhere does it say "Only", like in "Only retrieves the name of stored procedures". That means that #1 is also correct. The same goes for #2 and #3. Both the definition and the comments can be retrieved from sys.syscomments view, and again, none of the answers excludes the other options by saying "Only comments" or "Only definition".
The correct answer, in my opinion, should therefore be "All of the above"
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 1:06 AM
Points: 2,522,
Visits: 3,618
|
|
Nils Gustav Stråbø (12/1/2010) Both the definition and the comments can be retrieved from sys.syscomments view Are you sure about that? I can't see any comments in that view. With regards to option 1, I agree that this is not an invalid option. But #3 is the "precicest" option.
Best Regards,
Chris Büttner
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 1:06 AM
Points: 2,522,
Visits: 3,618
|
|
Carlo Romagnano (12/1/2010) I disagree: the query returns all rows that contains the word 'order' in the column [text] that may appear in comments or definition. I think the wording "consists" was just a language issue for a non-native speaker. But to me it was obvious that he meant "contain". With regards to the comments - I am not aware of any "comments" being in that system view. The name of the view & the text type values may lead you to this assumption, but I have never seen any comments in there.
Best Regards,
Chris Büttner
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 3:44 PM
Points: 1,786,
Visits: 3,323
|
|
Execute the following to create a proc called QotdFail
/* This is my comment */
create procedure QotdFail as
select 1 Then
SELECT DISTINCT OBJECT_NAME(id) AS [Column1] FROM sys.syscomments WHERE text LIKE '%This is my comment%' On SQL Server 2005 I get my QotdFail returned.
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Today @ 12:53 AM
Points: 3,189,
Visits: 4,142
|
|
Christian Buettner-167247 (12/1/2010)
Nils Gustav Stråbø (12/1/2010) Both the definition and the comments can be retrieved from sys.syscomments viewAre you sure about that? I can't see any comments in that view. Comments are part of a procedure's definition, so if you retrieve the definiton, you retrieve the comments as well.
CREATE PROCEDURE QOTD_Test AS PRINT 'This is a test'; -- this is a comment GO
SELECT "text" FROM sys.syscomments WHERE id = OBJECT_ID('QOTD_Test'); The result of the SELECT statement contains the "this is a comment" comment
|
|
|
|