Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

copy the select results into text file Expand / Collapse
Author
Message
Posted Wednesday, June 9, 2010 9:52 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, December 8, 2010 7:22 AM
Points: 46, Visits: 107
Post #934718
Posted Wednesday, June 9, 2010 9:58 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 6:53 AM
Points: 12,890, Visits: 31,851
if you use an enhanced text editor like EditPlus,NotePad++,UltraEdit or one of many others, you can do it in a couple of seconds flat:
copy and pasting from grid view of SSMS gives you tab delimited results.
then you can find and replace the regular expression \t for tab with the pipe charcter and you are done.


Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #934725
Posted Wednesday, June 9, 2010 10:00 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, December 8, 2010 7:22 AM
Points: 46, Visits: 107
Actually i am selecting the data in stored procedure. from stored procedure it self i need to upload the data into text file with | delimeter
Post #934726
Posted Wednesday, June 9, 2010 10:05 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 6:53 AM
Points: 12,890, Visits: 31,851
purushotham.k9 (6/9/2010)
Actually i am selecting the data in stored procedure. from stored procedure it self i need to upload the data into text file with | delimeter


In that case, look at either a CLR or xp_cmdshell calling bcp;
bcp has the ability to select a different delimiter when exporting.


Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #934731
Posted Wednesday, June 9, 2010 10:54 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 8:16 AM
Points: 6,582, Visits: 8,862
I'm not sure what you're after:
1. Are you running the procedure from SSMS, and you want to put the results into a text file with this delimiter?

2. Or do you want the procedure to put the results into a text file with this delimiter?

Either one is relatively easy, but to give the correct answer, we need to know exactly what you are doing.


Wayne
Microsoft Certified Master: SQL Server 2008
If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
Links: For better assistance in answering your questions, How to ask a question, Performance Problems, Common date/time routines,
CROSS-TABS and PIVOT tables Part 1 & Part 2, Using APPLY Part 1 & Part 2, Splitting Delimited Strings
Post #934775
Posted Wednesday, June 9, 2010 11:06 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 5:13 PM
Points: 33,100, Visits: 15,210
It would help if you explained how you are getting this data, show some code, and then explain what will happen. As Wayne mentioned, there are ways to do this, it would help if you stopped, thought about what you are doing, and then provide more information.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #934789
Posted Thursday, June 10, 2010 3:09 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, December 8, 2010 7:22 AM
Points: 46, Visits: 107
Through stored procedure i am selecting some values. I want to add couple of line in the end of sp to copy those values into one text file and plce that text in file into one location.
Post #935231
Posted Thursday, June 10, 2010 9:36 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 5:13 PM
Points: 33,100, Visits: 15,210
SQL Server can't work with files directly. How is the stored procedure being called? Is there some reason you can't use SSIS and then call a job to run that instead?






Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #935458
Posted Monday, January 23, 2012 8:31 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, January 8, 2014 4:07 AM
Points: 16, Visits: 110
I too have a similar requirement but we don't have SSIS installed so is there any way a Job can be run to direct the output from an executed sp to a file?
Post #1240238
Posted Monday, January 23, 2012 8:37 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, July 22, 2014 5:56 AM
Points: 2,013, Visits: 1,584
Please start another thread for your question & provide details. It will help us focusing on your issue specifically & won’t mix the responses for previous question.

Dev

Devendra Shirbad | BIG Data Architect / DBA | Ex-Microsoft CSS (SQL 3T) | Open Network for Data Professionals...
LinkedIn: http://www.linkedin.com/in/devendrashirbad
Post #1240246
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse