|
Posted by Steve Kass on 08/22/06 23:47
Molly and Erland,
I am able to reproduce this behavior. I think your coworker has somehow
saved his file as Unicode but without the Unicode byte order signifier
(0xFFFE for the more common little-endian ordering). I suggest you
check this by looking at one of the files as binary. Here's a way using
SQL Server 2005's new bulk rowset provider:
declare @s varbinary(max)
select @s = BulkColumn FROM OPENROWSET(BULK 'C:\MysteryQuery.sql', SINGLE_BLOB) AS t
select substring(@s,1,10)
To fix these files, you can open them in Notepad and Save As... on
top of the original file name, choosing Unicode in the Encoding
dropdown below the filename edit box. You could also insert the two
bytes FF FE into the beginning of the file with a hex editor.
Unfortunately, I can't speculate on what your coworking is doing to
cause this to happen, but I suspect he is using an alternative editor,
or perhaps he is transfering or copying the files in some way no one
else is.
Steve Kass
Drew University
www.stevekass.com
mollyf@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
>
Navigation:
[Reply to this message]
|