Solved

How to export the field Routine_Definition from SQL Server to Excel??

Posted on 2014-03-03
3
489 Views
Last Modified: 2014-03-03
I'm using this SQL Script to obtain a list of all of my Stored Procedures. This script contains a field that shows the entire TEXT found within each Stored Proc.

The issue is I need to get this data set result exported into EXCEL. When I attempt to COPY and/or IMPORT the data result set into Excel that data in field ROUTINE_DEFINITION will not import correctly. The field itself contains alot of text, commas, carriage returns, tabs etc and so is cauising the issue.

Is it possible to export a data set result such as this from sQL SERVER  into EXCEL..?

IF SO, ....HOW????

Here is the script if you'd like to try the export of the data yourself.


select SPECIFIC_CATALOG as [Database], specific_schema as [Schema], SPECIFIC_NAME as [StoredProcedureName], ROUTINE_DEFINITION as [StoredProcLogic],created  as [DateCreated], LAST_ALTERED  as [LastAltered]
  from YourDatabase.information_schema.routines
 where routine_type = 'PROCEDURE'
   and Left(Routine_Name, 3) NOT IN ('sp_', 'xp_', 'ms_')

Any assistance is greatly appreciated!
0
Comment
Question by:MIKE
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
John_Vidmar earned 500 total points
Comment Utility
If you copy/paste the results from a SQL tool into MS-Excel then you get the problem described (tabs put data into multiple columns).  MS-Excel can pull data directly from a database.  In MS-Excel 2003, under the Data-ribbon, Get External Data, use From SQL Server or From Microsoft Query (you'll need ODBC/DSN for this 2nd option).  A wizard will prompt you along the way.  When the results are imported into your sheet, I would change the column to allow wrapping.

In the future, you can open the MS-Excel Workbook and Refresh the data to get most recent changes to your stored-procedures.
0
 
LVL 17

Author Comment

by:MIKE
Comment Utility
I'll try this and see what happens, be in touch with my resultrs...thanks for the direction.
0
 
LVL 17

Author Closing Comment

by:MIKE
Comment Utility
PERFECTO..!!!! THANKS!!!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now