SQL Azure: SMO Exception when scripting objects in SSMS 2008 R2 - exception

I am using SQL Server Management Studio 2008 R2 to manage a SQL Azure database. When I try to right-click on any of the objects in the database, and do Script Table As -> CREATE -> New Query Editor Window, I get the following exception screen every time:
Scripting for SELECT -> New Query Editor Window is the only option that seems to work without generating an Exception like above. Any ideas??

Here are additional details about this issue.
Latest service update for SSMS: http://support.microsoft.com/kb/2507770
Blog discussing the necessary upgrade: http://social.msdn.microsoft.com/Forums/en-AU/ssdsgetstarted/thread/3dd65548-cf58-41e8-804d-3f6873132a7b

Related

sysprocesses table inside or outside a sql server agent job is not the same

I try to write a simple sql server agent job to run daily. The sql statement is as follows:
insert into testtable (nt_username, last_batch)
select nt_username, last_batch from master.sys.sysprocesses where nt_username <> ''
The same sql statement works great if I run it in management studio. But it only returns one record something like:
Administrator 2016-07-14 13:07:08.270
when it runs as a sql server agent job. As a result, it is useless. What did I do wrong and how to fix it? What is the correct sql statement for the same result that works as a sql agent job? My sql server is sql 2008 R2 with service pack 2 (10.50.4000) running on windows server 2008.
Thanks.
After some careful examination, it turns out the culprit is that the sql server agent process must be run under a domain account. I encountered the problem because it run under network service account. The weird part is the sql server also runs under the same network service account with no problems. What a headache this is especially when you are in a hurry to just get a thing to work.
Please do not use sysprocesses. It was deprecated when SQL Server 2005 was released, and the sys.sysprocesses "table" you are using is just a compatibility view. The MSDN page for sys.sysprocesses even has a note at the top stating:
This SQL Server 2000 system table is included as a view for backward compatibility. We recommend that you use the current SQL Server system views instead. To find the equivalent system view or views, see Mapping System Tables to System Views (Transact-SQL). This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.
You should instead use the new DMV (Dynamic Management Views):
sys.dm_exec_sessions
sys.dm_exec_requests
sys.dm_exec_connections
Please note that a Login might need to be granted the server-level permission of VIEW SERVER STATE in order to see more than their own data for sys.dm_exec_sessions and sys.dm_exec_requests, or see anything at all in sys.dm_exec_connections.
If this permission is needed, then the current database when you run the GRANT statement needs to be master as this is a server-level permission.

SSMS 2012 crashes with mssqllocaldb table edit top 200 rows

SQL Server Management Studio 2012
mssqllocaldb database
When I right click on a table and select Edit Top 200 Rows I get this error:
TITLE: Microsoft SQL Server Management Studio
Exception has been thrown by the target of an invocation. (mscorlib)
ADDITIONAL INFORMATION:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt. (Microsoft.VisualStudio.OLE.Interop)
SSMS then crashes.
It works just fine with databases attached to my SQLEXPRESS instance.

Entity Framework 5 and MySql in Visual Studio 2010 - Model First issue

I have application developed in Visual Studio 2010, .NET 4.0, using MySql database.
I have installed Entity Framework 5.0 and EF 5.x DbContext Generator for VB (using NuGet), then MySql Connector 6.5.5. I'm using Model First approach, so I created two tables, then I chose "Generate database from model.." option. After setting connection provider and connection parameters (with successful test connection to database), I clicked "Finish", and *.sql file was generated but nothing was created in my database. Worse still, the generated SQL script is in SQL Server Flavour and it has a header:
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/22/2013 12:11:00
-- Generated from EDMX file: C:\Apps\app\DataAccessLayer\DbModel.edmx
-- --------------------------------------------------
SET QUOTED_IDENTIFIER OFF;
GO
USE [MyDatabase];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO
(...)
How to enforce EF with Mysql and MySql Connector to automatically create database tables, and to generate MySql script, no SQL Server script?
Best regards,
WP
Question comments give us and answer. Summary:
1) Change DDL Generation Template property of the *.edmx model to SSDLToMySQL.tt (VS)
2) Database is not generated automatically. You must execute the generated script yourselves (In Visual Studio in Server Explorer view, or using other tools, i.e PhpMyAdmin).

Analysis Services Processing Task Fails When Run By SQL Server Agent

I have an SSIS package which contains an Analysis Services Processing Task.
This package is kicked off by a SQL Server Job in SQL Server 2008 R2.
If I run this job myself or process the cube manually everything is fine.
However if I schedule the job and let the SQL server agent run it then the Analysis Services Processing task fails stating Errors in the OLAP storage engine and that an error occurred while processing the one of the measure groups.
Has anyone else every seen anything like this?
The SQL Server Agent service account may not have sufficient permissions. You can validate this by doing any of the following:
Add the service account to the Administrators group on the analysis services server to validate this issue. Let the job run as scheduled.
Create a proxy that runs under your credentials and set the job to execute under the proxy. Let the job run as scheduled.
Change the SQL Server Agent to use your credentials. Let the job run as scheduled.
If the job completes successfully after making any of the above changes, then you have a permission issue that you need to resolve.
So after months of looking at this I finally realised the answer; of course it's a simple one.
The SSIS job I had created was processing the Cube only, while every time I processed manually in management studio I was processing the whole SSAS database.
I've now changed the SSIS package to process the whole database and everything seems to be working correctly.
when This Error Generate :
reporting services catalog database file existence failed sql server 2008 r2
================================================================================
This issue occurs because the databases for the SQL Server 2008 Reporting Services instance that you want to install already exist on the computer with following path.
C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA
Manually Remove .MDF and .LDF files of Report from above path and Re-run Setup.
In my case I found the solution in other way. First of all I login into analysus services using SQL management studio.Second of all I searched into databases folder the name of my project, after I open that and double clic in Roles folder, clic in new role, in this window I selected Membership in the left pane, clic in add button and search the NT AUTHORITY\Service, clic in Ok button and finally restart Sql analysis services. I tried to run my job and It works.

How do I use MySQL as data source in Microsoft SQL Server Analysis Services?

I have installed the latest .net connector, I can add MySQL databases as Data Sources, I can even browse through the data from Business Intelligence Studio.
The problem is that I cannot create a datasource view, or if I do create one without tables, trying to add them after the fact gives me the same error.
Specifically it looks like the data source view wizard tries to submit queries against the MySQL database using square brackets/braces, and the query bombs.
I get an error message like:
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 '[my_db].[cheatType]' at line 2
How can this be done?
Get the MySQL ( 6.3.5 ) .net connector ( from MY SQL )
Edit the connection string ( in the designer paste in the connection string ) so that it has the new "SQL SERVER MODE=True" option.
Apparently it affects performance - but what can you do
My sample connection string...(passwords & userids omitted )
server=svr215;User Id=;password=;Persist Security Info=True;database=dw;sql server mode=true
For any of you facing this issue more recently, there are two approaches that you may want to consider as well
Use the DevArt dotConnect connector at http://www.devart.com/dotconnect/mysql/. Using the .NET data source, you can connect your SSAS cube directly to MySQL.
Some have worked with doing OpenQuery connections to MySQL by connecting to SQL Server for the DSV and then using a linked server connection to MySQL. Some of those details are noted within http://dennyglee.com/2012/09/26/sql-server-analysis-services-to-hive/.
Try using Caps when adding it to the connection string:"....;Sql Server Mode=True"
Tried using named queries instead of tables?
Create a new named query in the DSV, as SELECT * FROM MySQLTable, then build in the DSV on top of that.
I would recommend using SQL Server. You will save yourself a lot of time and headache trying to do it this way. If your tables don't need transforming, just use SSIS to move the data from MySQL to SQL Server.
This is what we did at my previous employer - OLTP was MySQL and we built the warehouse in SQL Server, then used SSAS off of that warehouse for the cube.
I have tried with Visual Studio 2015 and SQL Server Data Tools 2015 on Windows 7 Machine, experiencing problems with the following versions:
net connector 7.0.4
net connector 7.0.3
net connector 7.0.2
net connector 6.9.8
net connector 6.9.7
net connector 6.9.6
net connector 6.9.5
net connector 6.9.4
net connector 6.9.3
net connector 6.9.2
net connector 6.9.1
net connector 6.9.0
net connector 6.3.5
from here: https://downloads.mysql.com/archives/c-net/
As a result:
The SSIS is working but SQL builder always failing.
The SSAS is not woriking as it cannot retrieve the database schema.
Finally, after hours i got it working with the following installation of new product of MYSQL Community from here: http://dev.mysql.com/downloads/file/?id=466291
Now, the only problem i expirienced was that the connector was unable to translate some queries due schema mapping, so setting sqlservermode=true to the connection string will fix that problem too!