Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
twinkle
Starting Member
2 Posts |
Posted - 2002-07-08 : 02:13:09
|
| Hello,Can u tell me how do I get the results of SQL select statements direcly saved to an output file specified via code...and not thru the query analyzer again and again...!I wannna use this query again and again and want to make that task easy..!Thanx,Twinkle |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-07-08 : 03:29:22
|
| see www.nigelrivett.com Creating a text file from a stored procedure.Probably osql is what you want.==========================================Cursors are useful if you don't know sql.Beer is not cold and it isn't fizzy. |
 |
|
|
cez
Starting Member
37 Posts |
Posted - 2002-07-08 : 03:37:02
|
| Hi !You can save the output of a stored procedure from another stored procedure like this :set @var = '"c:\folder\file.txt"'set @command = 'osql.exe -S <server> -U <login> -P <password> -d <database> -Q ' + '"sp_Your_Stored_Procedure " -o ' + @varEXEC master..xp_cmdshell @numefiswhere: <server> is the server name. use localhost if local<login> is the user who has the rights to login to the database<password> is the password for the <login><database> is the database nameRead more about osql.Hope it helps.Best,Cezar |
 |
|
|
|
|
|