Solved

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

Posted on 2014-03-03
3
492 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
ID: 39900449
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
ID: 39900497
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
ID: 39900507
PERFECTO..!!!! THANKS!!!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

920 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

15 Experts available now in Live!

Get 1:1 Help Now