Solved

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

Posted on 2014-03-03
3
501 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Job Hung 17 36
SQL Add Parameter in Variable 4 21
Need help with a query 14 35
SQL Server Extended Events: list of deadlocks growing too long - how to cleanup? 21 23
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

735 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