Query Results to File

  • HI,

    I have 2 environments. one is 2k and other is 2k5.

    I have a table xyz on a database on 2k.

    I take the backup of the DB and restore it on 2k5 server.

    i execute "select * from xyz" on both 2k and 2k5 query analyser and send the output to file.

    My problem is the file size is approximately double in 2k5 than in 2k.

    I want to know the reson for the same.

    Thanks

  • I would guess the larger file is unicode and the smaller is ascii. Check the character sets of the output files.

  • hi,

    Thanks Michael

    what you have suggested is correct.

    I executed the query in 2k5 and saved the output to file.

    then i opened the file in notepad and changed its encoding to ANSI from unicode(sql default).

    Now can you tell me as to where i can change the default setting.

    Cause i have checked under

    tools -> options -> query results -> sql server -> results to text but i didnt find the screen to change font or file type property which we get in 2k.

    Thank you

  • I don't think you have any control over it.

  • thanks

  • Prachin, why don't you use BCP command where you can execute your query and the results would be stored in text file. There you can also specify whether you want data in plain text or unicode format. For more details on BCP have a look at

    http://msdn.microsoft.com/en-us/library/ms162802.aspx

  • thanks again

    i got it using bcp as follows

    bcp "select * from db.obowner.tablename" queryout c:\200520.txt -Sservername/instancename -T -E -c -CACP

    but wanted to know where the option has gone in 2005

    thanks

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply