Unix Technical Forum

SQL Server 2005 Opening Script File Problem

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 ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 09:11 PM
mollyf@hotmail.com
 
Posts: n/a
Default SQL Server 2005 Opening Script File Problem

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 09:11 PM
mollyf@hotmail.com
 
Posts: n/a
Default Re: SQL Server 2005 Opening Script File Problem

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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-29-2008, 09:11 PM
Erland Sommarskog
 
Posts: n/a
Default Re: SQL Server 2005 Opening Script File Problem

(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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-29-2008, 09:12 PM
mollyf@hotmail.com
 
Posts: n/a
Default Re: SQL Server 2005 Opening Script File Problem


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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-29-2008, 09:12 PM
Erland Sommarskog
 
Posts: n/a
Default Re: SQL Server 2005 Opening Script File Problem

(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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-29-2008, 09:12 PM
mollyf@hotmail.com
 
Posts: n/a
Default Re: SQL Server 2005 Opening Script File Problem


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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-29-2008, 09:12 PM
Erland Sommarskog
 
Posts: n/a
Default Re: SQL Server 2005 Opening Script File Problem

(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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-29-2008, 09:13 PM
mollyf@hotmail.com
 
Posts: n/a
Default Re: SQL Server 2005 Opening Script File Problem

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-29-2008, 09:13 PM
mollyf@hotmail.com
 
Posts: n/a
Default Re: SQL Server 2005 Opening Script File Problem


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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 02-29-2008, 09:13 PM
Erland Sommarskog
 
Posts: n/a
Default Re: SQL Server 2005 Opening Script File Problem

(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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:38 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com