Showing posts with label waylike. Show all posts
Showing posts with label waylike. Show all posts

Monday, March 12, 2012

formatted outputs

Hi,
Is there a way to get stored procedure texts out in a formatted way
like defncopy in Sybase??? The way they print it out really
sucks.........
Regards
dba_sybaseYou can Use Enterprise manager to script them in formatted way .. unless you really not able to use Em .. or try using

exec sp_helptext 'sp_name'|||Thanks AAshu. I already knew that but it seems that the third pary application created the SP as a single line. So I couldnot find a way to formatt them other than formatting them by hand.

Thanks

Jaideep|||Try this trick for a select statement (not updates or deletes!):

Copy your line to the clipboard.
Open select a table (any table) in your database in Enterprise Manager, right click, and select show all rows (or show data, or whatever).
When the window opens up and displays the data, look for an icon near the top left that will display the SQL code applied (likely just a select from statement),
Replace the SQL Statement with what you have on the clipboard and requery by clicking the red "!" icon.
EM should reformat your code before displaying the results. If it doesn't, try adding a dummy table to the display and then removing it.

Sorry if this isn't step-by-step clear, but I'm going from memory.

Personally, I don't like the way EM formats statements, so I usually do some touch-up afterward, but its better than one long line of code.

blindman|||Thanks

formatted output

Hi,
Is there a way to get stored procedure texts out in a formatted way
like defncopy in Sybase??? The way they print it out really
sucks.........

Regards

SubhasSubhas (dba_sybase2003@.yahoo.com) writes:
> Is there a way to get stored procedure texts out in a formatted way
> like defncopy in Sybase??? The way they print it out really
> sucks.........

There is no command-line utility, but there are scripting facilities
both in Query Analyzer and Enterprise Manager.

In QA click F8 to get an Object Brower. Right-click a procedure and you
find the scripting option. In EM, right-click a database and pick
All Tasks and then Generate SQL Scripts.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp