-
Query output to file
Hi,
I dont know if anyone has faced this problem.
I have a database in SQL 2k, with a table xyz. I restore the same on SQL 2k5 enviornment.
select * from xyz is executed in 2000 and 2005 query analyzer. The output is directed to text file.
But the size of the file generated from 2005 is more (twice) than the one generated from 2000.
I would like to know the reason for the same.
Thanks & Regards
Prachin
-
What's file type? Compared contents of those files?
-
its a .txt file. The data is same in all fields as the table is restored from backup of 2000 database
-
Did you compare contents in those text files?
-
no i did not compare
why do i have to ?
the table is same in both 2k and 2k5
and i am giving a "select * from xyz" command
u can test with your own data.
-
The reason let you compare files is that I can't reproduce this issue on my servers. By the way, I'm not obligate to do testing for you.
-
hi rmia0
sorry if i offended you.
what i meant is i know my data is same on both the enviorments, but the query to output file size is different. and i am looking for a answer for the same. If someone tries it on his/her machine and gets the answer it would solve my question.
thanks
-
As I said, I tested on my servers and can't reproduce this issue. It's possible to append data to file instead of replacing, and shouldn't be that hard to compare files. There is COMP command in dos.
-
what i found out through someones help is that by default the file is saved in unicode format in 2k5.
if the file is opened in notepad and saved in ANSI format the file size gets reduced.
in 2k this option is avaliable when the results are saved to a file, but in 2k5 this option is not avaliable.
so a bcp command can be used as follows
bcp "select * from db.objectowner.tablename" queryout c:\200520.txt -Sservername/instancename -T -E -c -CACP
the "-CACP" option does the formatting.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|