Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: SQL Server 2005 Opening Script File Problem

  1. #1
    Join Date
    Oct 2008
    Posts
    22

    SQL Server 2005 Opening Script File Problem

    Hi All,
    I just installed SQL Server 2005 on my PC. I have some scripts written by one of my friend to create some tables and stored procedures. Whenever I go to open the script file the file opens in Notepad instead of appearing in the query window.
    How can i correct this.

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    You need to change association in windows. Try assoc command in command prompt or go to Windows explorer and go to Tools - folder options - File type and change association.

  3. #3
    Join Date
    Sep 2002
    Posts
    5,938
    Is file extension .sql? Will load .sql file in ssms by default.

  4. #4
    Join Date
    Oct 2008
    Posts
    22
    Hi skhanal,
    i did the above by making the sql extn as default in windows explorer but the .sql file still opens in notepad.

  5. #5
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932

  6. #6
    Join Date
    Sep 2002
    Posts
    5,938
    Or just right click .sql file and go to open with -> choose program..., select ssms then check 'always use the selected program to open this kind of file'.

  7. #7
    Join Date
    Jun 2004
    Location
    Atlanta and Manhattan
    Posts
    607

    A Simple Association is All You Need ....

    It's a common question. The response just before this one is what I tell clients / readers regularly ...

    Let us know if that doesn't do it for you ...

    Bill

  8. #8
    Join Date
    Oct 2008
    Posts
    22
    Hi skhanal,
    tried the above command on cmd prompt but the .sql file still opens in notepad and the contents are non-readable charaters. Is it something to do with the edition, i am using standard edition of MS-SQL 2005.
    Although the MSSMS gets open on click of .sql file but the end result is that the the contents of sql file opens in notepad. I think the MSSMS is making the .sql file to open in notepad. Any changes to be made in the settings of MSSMS??

    Regards
    Prashant
    Last edited by prashant12se; 10-21-2008 at 01:10 AM.

  9. #9
    Join Date
    Oct 2008
    Posts
    22
    Hi rmiao,
    have already tried the right click option on the .sql file, but it still opens in notepad..
    Last edited by prashant12se; 10-21-2008 at 01:07 AM.

  10. #10
    Join Date
    Sep 2002
    Posts
    5,938
    Not sure why all those didn't work on your pc. Anyway, you can open .sql file inside ssms.

  11. #11
    Join Date
    Jun 2004
    Location
    Atlanta and Manhattan
    Posts
    607

    Another Option ...

    And you could always open the file in notepad, etc., and cut and paste it to the Editor - then save the script among the RDBMS objects collection, etc.

    Good Luck ...

    Bill

  12. #12
    Join Date
    Oct 2008
    Posts
    22
    Hi All,
    the .sql file opens in MSSMS using notepad but the contents of the notepad are non-readable characters, so no use of copy-paste to the new query window. I couldn't found anythings as such to rectify this. Maybe there must be some settings to be done in MSSMS.

  13. #13
    Join Date
    Jun 2004
    Location
    Atlanta and Manhattan
    Posts
    607

    Can You Read the Text in NotePad?

    I thought you said you could open the file in Notepad in one of your earliest posts - and assume you can read it there. If so, can't you cut and paste it - from Notepad?

    BTW, I mean the Windows Notepad - good old Notepad.exe ...

    Thanks.

    Bill

  14. #14
    Join Date
    Sep 2002
    Posts
    5,938
    >> the contents of the notepad are non-readable characters

    Is it really a sql script for sql server?

  15. #15
    Join Date
    Oct 2008
    Posts
    22
    Hi, yes it's a .sql file..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •