I had an UPDATE statement which was executing properly. To clean up the code I have created a stored procedure in the Azure SQL database to take care of the update instead. However the stored procedure does not seem to get executed. My code is as follows. Is there any Azure limitation I am not aware of? Am I overlooking anything ? The SP does not return any value.
using (SqlConnection VDCRootConn = new SqlConnection(VDCRootConnectionString))
{
VDCRootConn.Open();
SqlCommand VDCRootSqlStatement = new SqlCommand("csp_update_table_sync_ledger", VDCRootConn);
VDCRootSqlStatement.CommandType = CommandType.StoredProcedure;
VDCRootSqlStatement.Parameters.Add(new SqlParameter("@sourceDbName", sourceDbName));
VDCRootSqlStatement.Parameters.Add(new SqlParameter("@sourceDbTablename", sourceDbTablename));
VDCRootSqlStatement.Parameters.Add(new SqlParameter("@sourceTableMaxSyncedRecordId", sourceTableMaxSyncedRecordId));
VDCRootSqlStatement.Parameters.Add(new SqlParameter("@clientId", clientId));
VDCRootSqlStatement.Parameters.Add(new SqlParameter("@sourceTablePrimaryKeyName", sourceTablePrimaryKeyName));
VDCRootSqlStatement.ExecuteNonQuery();
VDCRootConn.Close();
}
Update: It seems this is AZURE SQL permission issue. I have double-checked my credentials and permissions. Just to share my thought flow..
1) I can execute the SP from SQL Manager
2) I can validate I have permission to execute as 'MyLoginName'
SELECT HAS_PERMS_BY_NAME('dbo.csp_update_table_sync_ledger', 'OBJECT', 'EXECUTE');