June 9, 2010 at 9:52 am
๐
June 9, 2010 at 9:58 am
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
June 9, 2010 at 10:00 am
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
June 9, 2010 at 10:05 am
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
June 9, 2010 at 10:54 am
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
Author - SQL Server T-SQL Recipes
June 9, 2010 at 11:06 am
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.
June 10, 2010 at 3:09 am
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.
June 10, 2010 at 9:36 am
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?
January 23, 2012 at 8:31 am
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?
January 23, 2012 at 8:37 am
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.
January 23, 2012 at 8:55 pm
If you are running the SP in a query window then you can copy the results to a text file or an excel file.
In SSMS go to QUERY menu and there is an option called 'RESULTS TO'. In this option you can pick if you want to send it to a text file.
Lastly, if you are running the SP in a job then
Open the job that contains the command to run the SP. Go to the step that executes the SP then in the top left corner you will see the 'ADVANCED' tab. Click that tab and you will see an option to select an 'Output file' for that job step. If the SP is going to spit some results then those results will get saved in that file.
Blog
http://saveadba.blogspot.com/
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply