Issue creating asymmetric key

I am trying to run the code below but continuously get the error “The certificate, asymmetric key, or private key file is not valid or does not exist; or you do not have permissions for it.” I have tried changing file permissions, running as an administrator (this is on a local database), restarting the SQL […]

“No connection pool for UserActionEvent” when connecting to SqlServer

I have a simple ruby script. I need connection SqlServer and Mysql. I use gem ‘mysql2’ connection is successfully,but i use gem ‘tiny_tds’ and ‘activerecord-sqlserver-adapter’ is failed. my error: C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:570:in `retrieve_connection’: No connection pool for UserActionEvent (ActiveRecord::ConnectionNotEstablished) from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activerecord-4.2.7.1/lib/active_record/connection_handling.rb:113:in `retrieve_connection’ from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activerecord-4.2.7.1/lib/active_record/connection_handling.rb:87:in `connection’ from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/activerecord-4.2.7.1/lib/active_record/querying.rb:39:in `find_by_sql’ from D:/work/rails_obj/export_data/business/tear_bb.rb:49:in `main’ from export_data.rb:22:in `main’ from export_data.rb:28:in `<main>’ […]

Incorrect numbers outputted when flight data is NULL

I have a strange issue where in the final query resuls below, any rows that contains NULL under ‘DataFlight’ ,’ScheduledDepartureDate’ and ScheduledDepartureAirport’,displays the wrong count forStagingCabinCrew and StagingCockpitCrew. It show display 2 for stagingcabincrew and 0 for staging cockpitcrew for both those rows (row 3 and 4) but as you can see it doesn’t dispaly […]

How to set second database in laravel when main connection is down

I have a laravel project with many connections to different IP’s. I want laravel to connect to a backup database in the case that the main SQL server was down Example. 192.168.1.2 -> SQL DB #1 192.168.1.3 -> SQL DB #1 Backup If 192.168.1.2 goes down, laravel must connect to 192.168.1.3 I’d like to do […]

Create User-Defined Table Name in C# MSSQL

Good Day Devs! I want to know on how to create user-defined table name. I use 3 tier Architecture: BAL: public void Purchase1(BELPurchase BELPur) { SqlCommand cmd = new SqlCommand(); cmd.Connection = dbcon.getcon(); cmd.CommandType = CommandType.Text; cmd.CommandText = “CREATE TABLE [@Title] (VENDOR varchar(1000), ADDRESS varchar(1000), CONTROL_NO varchar(20), DATE date, TERMS varchar(20), QTY int, ITD varchar(1000), […]

Entity Framework – Log the SQL Query that caused SaveChanges to throw Exception

I am using Entity Framework 6 in a MVC web application and I am currently wrapping all calls to SaveChanges method in a try..catch block. Whenever an exception is caught, the exception details are being logged to a file and are also being emailed to a specific email address. Now, I also want the log […]

Why do I get bulk load data conversion error in SQL Server?

I’m new to SQL Server and I want to bulk insert any data. This is the table in the database: CREATE TABLE [dbo].[MARKAZ2] ( [id] [bigint] IDENTITY(1,1) NOT NULL, [city] [nvarchar](max) NULL, [center] [nvarchar](max) NULL, [copcity] [nchar](10) NULL, [start_tel] [nchar](20) NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] and this is bulk format file: 12.0 4 1 […]

What happens when an SQL entry contains SQL code?

I’ve done some searching and can’t seem to find an answer anywhere. What can happen (if anything) if an entry in an SQL DB contains actual SQL code? I’ve just found that an internal application at work (SQL based) can insert anything into a table including code. The datatype of the columns with this ability […]

Why Insert creates a transaction for itself? SQL Server

I execute this: SET IMPLICIT_TRANSACTIONS ON INSERT INTO Foo (counter) values ((select @@TRANCOUNT)) SELECT @@TRANCOUNT COMMIT Insert should trigger a transaction start. Expected: 1 is displayed and stored in the table. Actual: 1 is displayed, but 2 is stored in the table. Why SQL Server behaves like that – INSERT creates a transaction internally? It […]

SQL – How to combine the results from a UNION

UPDATE: As requested, Here is the ‘real’ SQL: SELECT p.ReferenceNumber, p.Name, ” as ‘Size of Prize’, ” as ‘Complexity’, pfc.ConfigurationValue as ‘Strategic Fit’ FROM FormConfigurations AS fc INNER JOIN ProjectForms AS pf ON pf.FormID = fc.FormID INNER JOIN ProjectFormConfigurations AS pfc ON pfc.ProjectFormID = pf.ID AND pfc.FormConfigurationID = fc.ID INNER JOIN Project AS p ON […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.