I have old .prc files (SQL Server Stored Procedures) which have exported from SQL Server 2000. Now when I try to open a .prc file using SSMS 2008, I get a bunch of chinese characters and other odd characters. I tried a solution found here, but it did not help.
Can you open the files in a regular text editor, e.g. Notepad or something??
As far as I remember, the SQL Server 2000 tools used to use ANSI / ISO-8869-1 encoding for their files, while newer Mgmt Studio version expect UTF-8 or UTF-16.
So my suggestion would be to open those *.PRC files in an editor and store them as *.SQL files using UTF-8 encoding. After that you should be able to open them in SSMS 2008 without problems.
Once I'd added PRC and UDF suffixes, ssms still ignored the changes if I used "recent files" to re-open the file was I working on.
I had to use File->Open to pick up the new suffixes. Thereafter "recent files" worked.
Related
I have a file about ~9GB. It's a file extracted from an old MS SQL server and I need to import it to a new one. The file has no extension.
When I try to open it through Microsoft SQL Server Management Studio 2014 I get the following error:
First of all, if you want to open a large file to read it, which i assume that it is not the case, pick one of the text editors from this post:
Text editor to open big files
And in case you want to execute really big SQL scripts, you will have to do it through the Windows CMD (or Bash in case you are using Ubuntu for example) using SQLCMD, have a look at this:
Execute large scripts using SQLCMD
I hope this is what you are looking for!
I have a .sql file with the datastructure and one with the inserts.
How can I import the to Microsoft SQL Server 2012 Management Studio? If anyone interest here is the file for inserts and for datastructure.
If you can't download the file you can find the content of datastructure here and for inserts here
If the files had contained sql code that you could run in SMSS you would use file->open->file (or ctrl+o) to open the file.
Your files however are MySQL dumps and contain code that MS SQL won't understand that you need to fix. Using the reference documentation it should be easy to alter the structure-file so that it works. In the insert-file you probably only need to remove the backticks.
I have a .sql file. How can I convert this .sql file to a .mdf SQL Server database file?
I know that .sql file is nothing but a script file if I open the .sql file in notepad it will show me the db code I can simply copy those code and paste into SQL Server Management Studio.
Is there any other way to convert .sql to .mdf file?
Unless your SQL file contains the script to create a database, your question wouldn't make any sense. If it does contain such script you need an environment to execute it. There are many tools that will allow you to do that. For example, many IDE tools that integrate with SQL Server have such capability.
So to answer your question: it is impossible to convert SQL file to MDF. You, however, can sometimes use an SQL file to build MDF.
I have a database that was given to me, but is in a file format (.sql). I want to open it in my SQL Server, but I don't know how, because it says i need a .mdf file?
Can someone help?
Open up the .sql file - if it contains SQL code in plain text, you have most likely received the database as a create script. Run it in SQL Server Management Studio.
A .sql file is (usually) just a series of SQL commands that you execute on the SQL server using your preferred GUI or CLI. Try opening it in Notepad to see what I mean.
Click on the data base.
Right click displays drop down menu.
Select execute SQL file.
Search for your .SQL file
Click on start button
Click close.
Press F5.
.Sql file is just a random file holding some SQL queries. While .mdf and .ldf are Microsoft SQL Server Database files which hold an entire database.
Run your file in SQL Server Management Studio.
When we create stored procedures in Visual Studio (with the extension .sql) the file encoding is automatically set to 'Unicode (UTF-8 with signature) - Codepage 65001'.
This causes ours DBA's problems as their scripts don't like it.
We have to manually go in and change them to 'Western European (windows) - Codepage 1252'.
This only seems to be happening since we upgraded to VS 2008 from 2005. Can anyone explain whats going on and how to stop it?
To summarise the link provided by Codeslayer (in case the page url changes)...
Change the sql file templates to ANSI encoding by opening with notepad and then saving it as an ANSI file. You can do the same for files already created.
\Common7\Tools\Templates\Database Project Items
You've just made our DBA's very happy!
I think somebody faced a similar problem like yours and had the following workaround which is posted at
http://connect.microsoft.com/VisualStudio/feedback/Workaround.aspx?FeedbackID=319830
For Visual Studio 2010, there is another set of files you need to update:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Extensions\SqlServer\Items