This is a discussion on SQL Server 2005 Opening Script File Problem within the SQL Server forums, part of the Microsoft SQL Server category; --> I just installed SQL Server 2005 on my PC (the developer's edition) yesterday. I have some scripts written by ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I just installed SQL Server 2005 on my PC (the developer's edition) yesterday. I have some scripts written by one of my coworkers to create some tables and stored procedures in a database that I've already created on my computer. Whenever I go to open the script file (whose icon shows that it's a SQL Server Query File and I've got the file type set to open with SQLWB - SQL Server Management Studio), the file opens in Notepad instead of appearing in the query window. My coworker told me that he just dragged and dropped the file in the query window and I tried that and got the same results (opening in Notepad). I can copy and paste the cotents of the file into the query window and run it but of course this gets cumbersome for long scripts. Is there a setting or something that I need to change? I have SQL Server 2000 installed on my computer too. Thanks. Molly J. Fagan |
| |||
| Followup to this: I copied and pasted a script and ran it and then saved it on my machine. I was able to open that copy the way I want to (not in Notepad). So is there something differently that needs to be done when running a script written by someone else? Thanks. mol...@hotmail.com wrote: > I just installed SQL Server 2005 on my PC (the developer's edition) > yesterday. I have some scripts written by one of my coworkers to > create some tables and stored procedures in a database that I've > already created on my computer. Whenever I go to open the script file > (whose icon shows that it's a SQL Server Query File and I've got the > file type set to open with SQLWB - SQL Server Management Studio), the > file opens in Notepad instead of appearing in the query window. My > coworker told me that he just dragged and dropped the file in the query > window and I tried that and got the same results (opening in Notepad). > I can copy and paste the cotents of the file into the query window and > run it but of course this gets cumbersome for long scripts. > > Is there a setting or something that I need to change? I have SQL > Server 2000 installed on my computer too. > > Thanks. > > Molly J. Fagan |
| |||
| (mollyf@hotmail.com) writes: > I just installed SQL Server 2005 on my PC (the developer's edition) > yesterday. I have some scripts written by one of my coworkers to > create some tables and stored procedures in a database that I've > already created on my computer. Whenever I go to open the script file > (whose icon shows that it's a SQL Server Query File and I've got the > file type set to open with SQLWB - SQL Server Management Studio), the > file opens in Notepad instead of appearing in the query window. My > coworker told me that he just dragged and dropped the file in the query > window and I tried that and got the same results (opening in Notepad). > I can copy and paste the cotents of the file into the query window and > run it but of course this gets cumbersome for long scripts. > > Is there a setting or something that I need to change? I have SQL > Server 2000 installed on my computer too. First thing is to go the Windows Explorer, and in the menu pick Tools->Folder Options, and there to go the View tab. Make sure that "Hide file extentions for known file types" is unchecked. (Overall, any good programmer who gets a new box should always go this dialog and change this setting and a few more which have stupid defaults.) Now you can see which extensions, you coworker's file has. In the next tab in Folder Options, you can check the association for that file type. You can also change associations from Tools->Customise->Text Editor in Mgmt Studio. -- Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx |
| |||
| Erland Sommarskog wrote: <snip> > First thing is to go the Windows Explorer, and in the menu pick > Tools->Folder Options, and there to go the View tab. Make sure that > "Hide file extentions for known file types" is unchecked. (Overall, any > good programmer who gets a new box should always go this dialog and > change this setting and a few more which have stupid defaults.) > > Now you can see which extensions, you coworker's file has. In the next > tab in Folder Options, you can check the association for that file type. > You can also change associations from Tools->Customise->Text Editor in > Mgmt Studio. > Like I said in my original post--the application associated with the file is SQL Server 2005 (has the new icon associated with it and has the file extension of .sql). It was the very first thing I checked when it happened the first time. I went and did what you said in Mgmt Studio and still no change--the file opened up in Notepad. Another thing that I noticed is that any queries that I wrote for SQL 2000, I can open them in Mgmt Studio but not the ones created by my coworker. The other gal who works in our department hasn't run into the same problems that I have. I copied and pasted the scripts written by my coworker into the query window and ran them and they ran perfect so it would appear that it's not a permissions issue or anything like that. Thanks. Molly J. Fagan |
| |||
| (mollyf@hotmail.com) writes: > I went and did what you said in Mgmt Studio and still no change--the > file opened up in Notepad. This happens when you double-click on the file in Explorer, I assume. Or does happen when you open the file from withing Mgmt Studio as well? That would be really wild. -- Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx |
| |||
| Erland Sommarskog wrote: > (mollyf@hotmail.com) writes: > > I went and did what you said in Mgmt Studio and still no change--the > > file opened up in Notepad. > > This happens when you double-click on the file in Explorer, I assume. > Or does happen when you open the file from withing Mgmt Studio as well? > That would be really wild. > > > -- > Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se > > Books Online for SQL Server 2005 at > http://www.microsoft.com/technet/pro...ads/books.mspx > Books Online for SQL Server 2000 at > http://www.microsoft.com/sql/prodinf...ons/books.mspx Yes it happens when I double-click on the file in Explorer and within Mgmt Studio. All of my .sql files have had the little icon thing associated with them ever since I installed SQL Server 2005 but I can only open the files I created myself in Mgmt Studio--not the ones that my coworker gave me. On Monday I'm going to have my other coworker create a script and put it on the network drive for me to access (my other coworker e-mailed the others) and I'm going to have her try opening a script coming from my machine. Molly J. Fagan |
| |||
| (mollyf@hotmail.com) writes: > Yes it happens when I double-click on the file in Explorer and within > Mgmt Studio. All of my .sql files have had the little icon thing > associated with them ever since I installed SQL Server 2005 but I can > only open the files I created myself in Mgmt Studio--not the ones that > my coworker gave me. On Monday I'm going to have my other coworker > create a script and put it on the network drive for me to access (my > other coworker e-mailed the others) and I'm going to have her try > opening a script coming from my machine. Try this. From the menu in Mgmt Studio, select File->Open->File. Navigate to the directory where you have one of these suspect files. Select such a file, and then click the arrow on the left of the Open button and Select Open With. You now get a window that presents you with a whole range of editors, and on the top one is listed by default. Which editor is this? Interesting enough, Notedpad does appear in this list, although I don't get it as the default for any file. -- Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx |
| |||
| Erland Sommarskog wrote: > Try this. From the menu in Mgmt Studio, select File->Open->File. Navigate > to the directory where you have one of these suspect files. Select such > a file, and then click the arrow on the left of the Open button and > Select Open With. > > You now get a window that presents you with a whole range of editors, > and on the top one is listed by default. Which editor is this? > > Interesting enough, Notedpad does appear in this list, although I > don't get it as the default for any file. > I tried what you said to do. The SQL Server Query Editor was shown as being the default editor and I clicked on the "Set as Default" just to "make sure." Then I clicked on the OK button and got the following error: "The file cannot be opened with the selected editor. Please choose another editor." I just checked with my other coworker and she has the same thing happening on her machine--the scripts open up in Notepad if she double-clicks on them or by going through the File, Open option. Like I've said before, copying and pasting the scripts and running them that way does work so it's not an issue with errors in the scripts. Plus I've saved the script with a different name (after copying and pasting) and have been able to open them up the way I want to. I'm wondering if there's some unknown bug or some unknown issue about permissions or something that could be causing this. Thanks. Molly J. Fagan |
| |||
| mollyf@hotmail.com wrote: <snip> I've been messing around with things off and on today and it's starting to look like if the create date and modified date of the file do not match, that's when the script opens in Notepad, unless I make any changes to the script within Mgmt Studio. Is there some sort of security options in SQL Server 2005 that checks for stuff like this? Molly J. Fagan |
| ||||
| (mollyf@hotmail.com) writes: > I've been messing around with things off and on today and it's starting > to look like if the create date and modified date of the file do not > match, that's when the script opens in Notepad, unless I make any > changes to the script within Mgmt Studio. Is there some sort of > security options in SQL Server 2005 that checks for stuff like this? To be perfectly honest, I have no idea. I will have to admit that at this point, I'm just perplexed. I've posted a summary of the thread to our internal MVP forum where also Microsoft people hang out. Let's see if that brings anything up. By the way, in that Open With dialog did you try any other editor like the XML editor? Not that it is a very meaningful operation, but just out of curiousity. -- Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx |