| Author |
Topic |
|
pyromelana
Starting Member
23 Posts |
Posted - 2009-03-17 : 12:05:40
|
| I would like to write the result of my query into a result.txt- file on the serverHow can I do this? Do I have to write a cmdshell (or whatever) or are there some sql-statements that are able to write the result into a txt? |
|
|
pootle_flump
1064 Posts |
Posted - 2009-03-17 : 12:13:57
|
| Can you use xp_cmdshell? Have you used BCP? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-03-17 : 13:20:46
|
| if you're asking about editor in sql mgmnt studio, you've an option results as file where on executing query it will ask for saving to file the results. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
pyromelana
Starting Member
23 Posts |
Posted - 2009-03-18 : 06:55:26
|
quote: Originally posted by visakh16 if you're asking about editor in sql mgmnt studio, you've an option results as file where on executing query it will ask for saving to file the results.
Sorry, did not get it... Do you tell me that the SQL Server Management Studio has this possibility? Ok, not clear for me. Never mind, how does it work? |
 |
|
|
matty
Posting Yak Master
161 Posts |
Posted - 2009-03-18 : 07:03:01
|
| In SQL Server Management Studio ,Choose from Query->Results To ->Results To File |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-03-18 : 07:04:21
|
| declare @BCP_MissingLinks varchar(8000)select @BCP_MissingLinks = 'bcp '+'"select Linkname from project.dbo.BCPLinkname"'+' queryout e:\Reports\MissingLinks.csv -c -t, -S172.16.3.226 -Usa -Pxxxxxxx'exec master..xp_cmdshell @BCP_MissingLinksRegardsSenthil.C----------------------------------------------------------------------------Server: Msg 3902, Level 16, State 1, Line 1The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION. |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-03-18 : 07:45:25
|
quote: Originally posted by visakh16 if you're asking about editor in sql mgmnt studio, you've an option results as file where on executing query it will ask for saving to file the results.
this wouldn't save result on the server. it'll save it on client machine. O/P wants it on server. |
 |
|
|
pyromelana
Starting Member
23 Posts |
Posted - 2009-03-18 : 08:32:17
|
quote: Originally posted by matty In SQL Server Management Studio ,Choose from Query->Results To ->Results To File
LOL.. joking or what? In the final version there is noone who can click... that should later work automatically... |
 |
|
|
|