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
Solved

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

Posted on 2014-03-03
3
500 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

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…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

790 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