0

Normally successful execution of

sp_help [object_name]

in SQL Server returns a total of 7 output windows with various results out of which normally I am interested in only 2 windows namely the one with all the column information and the one with the constraints.

Is there a way I can tell SQLserver to only display these while formulating the command?

slacker
  • 157
  • 1
  • 3
  • 13

1 Answers1

1

Short answer: no, you can't do this directly because the procedure is written to return that data, and TSQL has no mechanism for accessing specific result sets.

Long answer: but you can easily get the same information from other procedures or directly from the system catalog:

  • sp_columns, sp_helpconstraint (this is actually called by sp_help) etc.
  • sys.columns, sys.objects etc.

There's also the option of copying the source code from sp_help and using it as the basis of a new procedure that you create yourself, although personally I would just write it myself from scratch. If you do decide to write your own stored proc, you might find this question relevant too.

Community
  • 1
  • 1
Pondlife
  • 15,992
  • 6
  • 37
  • 51