azure-sql-database

EF Core Connection to Azure SQL with Managed Identity

房东的猫 提交于 2019-12-20 17:34:53
问题 I am using EF Core to connect to a Azure SQL Database deployed to Azure App Services. I am using an access token (obtained via the Managed Identities) to connect to Azure SQL database. Here is how I am doing that: Startup.cs: public void ConfigureServices(IServiceCollection services) { //code ignored for simplicity services.AddDbContext<MyCustomDBContext>(); services.AddTransient<IDBAuthTokenService, AzureSqlAuthTokenService>(); } MyCustomDBContext.cs public partial class MyCustomDBContext :

SQL Azure + Getting an error 'There is already an open DataReader associated with this Command..', even after setting ‘MultipleActiveResultSets=True’

南笙酒味 提交于 2019-12-20 16:48:09
问题 We are facing some issues with the deployed version of our application on cloud. Our application is an ASP.NET MVC 3 project with ADO .NET Entity Framework. According to the msdn blogs, we need to add the parameter ‘MultipleActiveResultSets=True’ (for Entity Framework with SQL azure) in our database connection string which we have rightly done. We get the following exception while executing a database query from our application: ‘’There is already an open DataReader associated with this

Using SQLServer contains for partial words

时光总嘲笑我的痴心妄想 提交于 2019-12-20 10:29:16
问题 We are running many products search on a huge catalog with partially matched barcodes. We started with a simple like query select * from products where barcode like '%2345%' But that takes way too long since it requires a full table scan. We thought a fulltext search will be able to help us here using contains. select * from products where contains(barcode, '2345') But, it seems like contains doesn't support finding words that partially contains a text but, only full a word match or a prefix.

SQL Server creating table with clustered index without a primary key

▼魔方 西西 提交于 2019-12-20 10:27:07
问题 Is it possible to create a clustered index from a create table statement in SQL Server 2008 that is not a primary key? The purpose of this is for a table in SQL Azure, so it is not an option for me to first create the table, and then create the clustered index on the table. Edit: Apparently it was FluentMigrator that was causing my problems, it's version table does not have a clustered index so it was erroring trying to create the versioning table not my table. 回答1: Yes, it is possible to

SQL Azure table size

℡╲_俬逩灬. 提交于 2019-12-20 08:01:42
问题 In mssql2005 when I want to get size of table in MBs, I use EXEC sp_spaceused 'table'. Is there any way to get space used by particular table in SQL Azure using some query or API? 回答1: From Ryan Dunn http://dunnry.com/blog/CalculatingTheSizeOfYourSQLAzureDatabase.aspx select sum(reserved_page_count) * 8.0 / 1024 [SizeInMB] from sys.dm_db_partition_stats GO select sys.objects.name, sum(reserved_page_count) * 8.0 / 1024 [SizeInMB] from sys.dm_db_partition_stats, sys.objects where sys.dm_db

Checking if database exists or not in SQL Azure

旧时模样 提交于 2019-12-20 05:48:29
问题 Could any one please tell me how to code whether a database exists or not in sql azure ? 回答1: Have you tried querying the sys.databases table? That should give you what you're looking for. More info here. Note: You'll want to run this query against the Master database. Otherwise, you'll only see the name of the current database (and Master). 回答2: if exists (select * from master.sys.databases where name = '[enter name here]') 回答3: Select count(*) from sysobjects where name = 'testdb' returns 0

Multi-tenant application on Windows Azure

一笑奈何 提交于 2019-12-20 04:30:34
问题 We want to create multitenant application with shared database table structure. Currently with standard SQL Server we could achieve that with providing TenantID for each table. Could we achieve the same on Windows Azure, but without TenantIDs? Best regards, Alexey Zakharov 回答1: The question was about another thing. I want to know if Azure SQL provide multi tenant database with shared schema as a feature. – Alexey Zakharov May 21 at 6:00 The short answer is that it doesn't. SQl Azure is

SQL CE azure connection

一世执手 提交于 2019-12-20 03:26:11
问题 I am using azure to publish an asp.net application, when I publish locally it works fine, but on Azure all things related with database isnt showing up and getting "The page cannot be displayed because an internal server error has occurred." Wondering if it could be somthing wrong with my connection string. http://webly.azurewebsites.net/ App_Data folder with webly_data.sdf Bin: webly.dll ... Simple.Data.SqlCe40.dll <connectionStrings> <add name="webly" connectionString="Data Source=

Azure Data Factory Copy Identity Column With Gaps

可紊 提交于 2019-12-20 02:48:11
问题 I created a pipeline and two linked services to move data from an on-prem instance of SQL Server to an Azure Sql instance. The issue I'm running into is that we have a table "Table-1" in our on-prem with an Identity (1,1) column that is missing a sequential ID (e.g. the values are 1, 2, 3, 4, 6). When the pipeline runs, it tries to insert the rows with the ID's 1, 2, 3, 4, 5 which is a big problem because ID 6 is a foreign key on another table "Table-2" and now it doesn't exist, so the

Azure Error: A network-related or instance-specific error occurred while establishing a connection to SQL Server

时光毁灭记忆、已成空白 提交于 2019-12-20 01:47:19
问题 I have SQL server & web app hosted over Microsoft Azure platform. I am constantly getting above error when ever i run web application (and try to connect azure sql server) from my local network, however i never face issue on azure web app service (i.e. After hosting my web app on azure) I know that this error is very familiar. But in this case it seems weird. I have already checked below things, SQL connection is managed properly. (I am using ADO.Net) All gateway IPs are white listed against