I was trying to use TRY..CATCH feature in SQL Server 2005's Stored Procedure but it didn't worked. I checked my version using ##VERSION, it displayed "MS SQL Server 2000 - 8.00.194 (Intel X86) " but when I clicked on Help->About, it displayed "9.00.1399.00" which clearly specifies that I have SQL Server 2005 installed.
I know that TRY..CATCH can only be used on SQL server 2005 or above..
My system might be using Sql Server 2000 as source database or something like that, I might be wrong in describing. How to change it then..
After re-reading your question, you clearly have SQL Server 2005 client tools (SSMS) installed, and have your database on a SQL Server 2000 server, so you cannot use TRY..CATCH. Period.
Assuming you really do have a SQL Server 2005 server, have you ensured the specific database has its compatibility level set to 90 (SQL Server 2005)?
Right click database->Properties->Compatibility level
This can happen if you upgrade the server and forget to upgrade the database compatibility level.
help..about gives you the version of the client tools (SSMS)
SELECT ##VERSION gives you server version
If the server version is 8.x then you have SQL Server 2000 which does not support TRY/CATCH. No amount of fiddling with Compatibility level will fix this.
You have 3 practical options
Don't use TRY/CATCH
Upgrade your server version
Install a names SQL Server 2005 instance on the same box
Related
Having troubles connecting MS Access 2003 into SQL Server 2012 back-end. Working with another team to figure out the issues. I am wondering if there is a limit as to how far forward Ms Access 2003 can go?
To my knowledge there is no version-specific limit; it really depends on what specifically you are trying to do. For example, I just successfully connected to SQL Server 2014 Express (running on Windows 7) from Access 2003 (running on Windows Server 2003) using the old "SQL Server" ODBC driver. I currently don't have ready access to a SQL Server 2016 instance, but I would expect that simply establishing such a connection would be technically possible as well.
No doubt such a connection will be unable to take advantage of some newer SQL Server features, e.g., those supported by newer ODBC drivers like "SQL Server Native Client" and its successors. However, many of those features are largely irrelevant to an Access/SQL_Server setup anyway (with the possible exception of datetime2 column support). The key point is that there is no hard limit that "Access 2003 is simply unable to connect to SQL Server version 'x' or newer.".
2012-10-04:
SQL Server 2008 Management Studio has intellisense, and it is very helpful, but it is case-sensitive.
For example, I have 3 tables:
Gy_Customer_Email
Gy_Customer_Para
gy_customertemp
Here's how intellisense behaves:
select * from gy_customer -- My input
gy_customertemp -- Intellisense suggestion
select * from Gy_Customer -- My input
Gy_Customer_Email -- Intellisense suggestion
Gy_Customer_Para -- Intellisense suggestion
I want to Intellisense to display all 3 options, regardless of case. How can I do that?
2012-10-08:
Thanks for Ashley Ross!
I had installed Service Pack 1 for SQL Server Management Studio according to your reference point, but the issue is still not resolved.
What should I do next?
My SQL Server Management Studio's option:
My SQL Server Management Studio's version
This issue has been reported at least two times on Microsoft Connect:
http://connect.microsoft.com/SQLServer/feedback/details/672196/t-sql-is-not-case-sensitive-but-t-sql-intellisense-is
http://connect.microsoft.com/SQLServer/feedback/details/402225/ssms-intellisense-make-text-matching-case-insensitive
Both issues are closed, and the problem has apparently been fixed in SQL Server 2008 R2 SP1 and in SQL Server 2012.
You should be able to install the updated SQL Server Management Studio on your development PC to resolve the problem you're having, without having to upgrade your database server.
I'm trying to trace a SQL Server 2008 database, but I only have SQL Profiler 2005 available to me. (Don't ask why, it doesn't make sense to me either). When I try to start a new trace, I get "Unable to locate trace definition file for Microsoft SQL Server version 10.0.0. Click OK to retrieve it from the server. Retrieval may take a few moments".
I click Ok, then ... nothing.
Is there a way I can get this to work?
You have to copy files from a SQL Server 2008 installation into the SQL Server 2005 installation. Copy "Microsoft SQL Server TraceDefinition 10.0.0.xml" (and "Microsoft SQL Server TraceDefinition 10.50.0.xml") from "C:\Programme\Microsoft SQL Server\100\Tools\Profiler\TraceDefinitions" into "C:\Programme\Microsoft SQL Server\90\Tools\Profiler\TraceDefinitions".
To be able to save templates, you have to create a new folder in "C:\Programme\Microsoft SQL Server\90\Tools\Profiler\Templates". For SQL Server 2008 add a directory named "100", for SQL Server 2008R2 add a directory named "1050". If you don't have access to an SQL Server 2008 Profiler installation, you can copy the existing templates for SQL Server 2005 from "C:\Programme\Microsoft SQL Server\90\Tools\Profiler\Templates\90" - they work with SQL Server 2008 too.
I think this should be possible, provided you can get the SQL2008 trace definitions, the ones that install with SQL2005 are located here:
C:\Program Files\Microsoft SQL Server\90\Tools\Profiler\TraceDefinitions
If you can get the SQL2008 versions (they are XML files) you should be good to go, hope this helps!
I have an old version of Microsoft Content Management System (MCMS-2002). I have a request to update our database server from sql2005 to sql2008. I can migrate the cms database just fine from 2005 to 2008, and I can set the compatibility mode to 2005.
However, when I use the Database Configuration Application (from MCMS) to point at the sql2008 server I get the following error:
Unable to use selected SQL Server. The
server must be SQL Server 2000 Service
Pack 2 or better.
I find it ironic, but frustrating, that it doesn't recognize the newer version of sql server. I have found some indications that MCMS queries the database for its version number but only accepts a single digit version number.
So SQL2000 -> version 8
SQL2005 -> version 9
SQL2008 -> version 10 : but MCMS only gets Version 1 and thinks it is a VERY old version.
Has anyone else experienced this issue and found a solution?
This problem is similar to the MCMS' J# version problem where setup is asking for version 3.0 which does not even exist.
I hope somebody does find a workaround as we are about the face the same problem soon.
Are there any free solutions for automatically migrating a database from MySQL to SQL Server Server that "just works"?
I've been attempting this simple (at least I thought so) task all day now. I've tried:
SQL Server Management Studio's Import Data feature
Create an empty database
Tasks -> Import Data...
.NET Framework Data Provider for Odbc
Valid DSN (verified it connects)
Copy data from one or more tables or views
Check 1 VERY simple table
Click Preview
Get Error:
The preview data could not be
retrieved. ADDITIONAL INFORMATION:
ERROR [42000] [MySQL][ODBC 5.1
Driver][mysqld-5.1.45-community]You
have an error in your SQL syntax;
check the manual that corresponds to
your MySQL server version for the
right syntax to use near
'"table_name"' at line 1 (myodbc5.dll)
A similar error occurs if I go through the rest of the wizard and perform the operation. The failed step is "Setting Source Connection" the error refers to retrieving column information and then lists the above error. It can retrieve column information just fine when I modify column mappings so I really don't know what the issue is.
I've also tried getting various MySql tools to output ddl statements that SQL Server understand but haven't succeeded.
I've tried with MySQL v5.1.11 to SQL Server 2005 and with MySQL v5.1.45 to SQL Server 2008 (with ODBC drivers 3.51.27.00 and 5.01.06.00 respectively)
There are two free toolkits provided by Microsoft.
Microsoft SQL Server Migration Assistant for MySQL v1.0
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=14280
Microsoft SQL Server Migration Assistant for MySQL v5.1
http://www.microsoft.com/download/en/details.aspx?id=26712
I have used only the second one and it worked for me without any glitch.
It required registration with Microsoft for downloading a license file.
But it is free to use for everyone.
This is really old now, but if you use MySQL Connector NET and set SQL Server Mode = true in the connection string, this will resolve your error.
Recently, I have successfully migrated the MySQL database to MSSQL database. Below are detailed steps:
Operating System: AWS Microsoft Windows Server 2012 R2 with SQL Server Standard
Tools Used:
SQL Server 2014 Management Studio SQL Developer,
Microsoft SQL Server Migration Assistant v6.0.1 for MySQL,
Remote Desktop Client, and
Third Party MySql ODBC Driver 5.1.13
1. Setup AWS Windows Server
2. From the AWS console ec2 instance list, right click on the windows server and select connect. You would see the similar screen below.
3. Click on the Get Password button which will be required for Remote Desktop connection[#4] and follow the instructions.
4. Connect to that EC2[#1] instance with the Remote Desktop Client by default available in your Ubuntu local machine. Use the credentials from #2.
5. Once you get connected using the remote client, you should be able to access the remote MSSQL server. Install the following tools.
Install Chrome : Since internet explorer has some security, install chrome.
Install Microsoft SQL Server Migration Assistant v6.0.1 for MySQL
https://www.microsoft.com/en-us/download/details.aspx?id=51218
Install Third Party MySql ODBC Driver 5.1.13
https://dev.mysql.com/downloads/connector/odbc/5.1.html
6. Configure ODBC Data Sources(64-bit) :
Open Administrative tools → click on ODBC Data Sources(64-bit) and
follow the steps to connect to MySQL database.
7. Open SQL Server 2014 Management Studio SQL Developer and connect using windows authentication.
Create destination MSSql database for MySql migration.
8. Open Microsoft SQL Server Migration Assistant : For detail visit this link: https://blogs.msdn.microsoft.com/ssma/2011/02/07/mysql-to-sql-server-migration-how-to-use-ssma/
Create new project
Connect to MySql
Connect to MSSql
Convert Schema
Migrate Data
8. You might have some problem listed here. Please read in detail where I have written the detail resolution.
MySql 5.6 to MSSql server 2014 migration : ExecuteReader requires an open and available Connection
I am afraid there is no simple solution. SQL used in MySQL and T-SQL used in SQL Server 200X are different dialects of SQL. It is not only simple changing say "auto_increment" to "identity", but reserved words that creates a problem.
For example
CREATE TABLE test (
user varchar(50)
)
will work in MySQL and fail in SQL Server 2008.
To cut long story short - unfortunately, you will need to do it by hand.
Export the file from MySQL to a CSV file.
Export the create statements for the tables from MySQL
Cry.
3a. Disable foreign key checks in SQL server
Tune the create statements in SQLserver until they work.
Import the CSV files in to MySQL.
5a. Enable foreign key checks in SQL server.
Also see these answers:
migrate-from-mysql-to-sql-server-2008
Had similiar issue about this error 42000, and for me I figured out that setting the MySQL global mode to ansi_quotes would solve it:
set global sql_mode=ansi_quotes;
There are commercial solutions, but not free solutions. Depending on complexity of your database, rewriting SQL for target dialect can be trivial task - or a very hard one.
Rewriting CREATE TABLE statements is never hard, it can be done by hand with no surprises. Procedures, functions and triggers are problematic.