sql-server-2016

Error while using SSMS 2016 : Object cannot be cast from DBNull to other types

左心房为你撑大大i 提交于 2019-12-04 15:36:05
Can anyone resolve this issue: SQL Server Management Studio 2016 CTP3 (13.0.900.73) on a Windows 10 Laptop Object Explorer > Server > Databases > Database Right Click - Properties Instead of getting the Database Properties dialogue box I instead get this pop-up: TITLE: Microsoft SQL Server Management Studio Cannot show requested dialog. ADDITIONAL INFORMATION: Cannot show requested dialog. (SqlMgmt) Object cannot be cast from DBNull to other types. (mscorlib) BUTTONS: OK Edit: Issue is occuring on-Prem with both physical and virtual machines. It is also happening on Amazon RDS servers. If I

How can I delete the columns in DataFlow Task in SSIS?

走远了吗. 提交于 2019-12-04 11:43:08
I use SQL Server 2016 and I have a very busy DataFlow task . In my DataFlow task , I use Multicast component for some reason. After creating a new Flow in my DataFlow , I need to delete some of the columns in the new flow because they are useless. Just for more information, I need to do that because I have more than 200 columns in my flow and I need less than 10 of those columns. How can I delete the columns in DataFlow Task in SSIS? You can add an extra component of some sort. However, this will never reduce complexity or improve performance. Just thinking about it, logically, you are adding

Why is 199.96 - 0 = 200 in SQL?

我是研究僧i 提交于 2019-12-04 07:48:51
问题 I have some clients getting weird bills. I was able to isolate the core problem: SELECT 199.96 - (0.0 * FLOOR(CAST(1.0 AS DECIMAL(19, 4)) * CAST(199.96 AS DECIMAL(19, 4)))) -- 200 what the? SELECT 199.96 - (0.0 * FLOOR(1.0 * CAST(199.96 AS DECIMAL(19, 4)))) -- 199.96 SELECT 199.96 - (0.0 * FLOOR(CAST(1.0 AS DECIMAL(19, 4)) * 199.96)) -- 199.96 SELECT 199.96 - (CAST(0.0 AS DECIMAL(19, 4)) * FLOOR(CAST(1.0 AS DECIMAL(19, 4)) * CAST(199.96 AS DECIMAL(19, 4)))) -- 199.96 SELECT 199.96 - (CAST(0.0

SQL won't connect after deploying

假装没事ソ 提交于 2019-12-04 07:20:52
I recently deployed my website on IIS (LocalDB). But whenever I try to run the website, the SQL fails to connect. I've been through hundreds of posts/articles now but I am unable to resolve it. Error A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows

SQL Server JSON_Modify, How to Update all?

老子叫甜甜 提交于 2019-12-04 07:04:15
i am trying update all columns with a value with Json_Modify: DECLARE @JSON NVARCHAR(MAX) SET @JSON = N'{ "A":1, "TMP": [ {"A":"VALUE1", "B": "VALUE2", "C": 1}, {"A":"VALUE3", "B": "VALUE4", "C": 2}, {"A":"VALUE5", "B": "VALUE6", "C": 3}]} ' SET @JSON = JSON_MODIFY(@JSON, '$.TMP.A', 'JEJE') SELECT * FROM OPENJSON(@JSON, '$.TMP') WITH ( A NCHAR(10), B NCHAR(10), C INT ) I need update all columns "A" with "JEJE" for example, it is not working. Here are two options. Disclaimer: I am not a pro at JSON through sql server 2016, but I have hacked some stuff together. Option 1: You are clearly

SQL Server bug or feature? Decimal numbers conversion

夙愿已清 提交于 2019-12-04 00:06:19
During development faced up with quite a strange SQL Server behavior. Here we have absolutely the same formula for absolutely the same number. The only difference is how we are getting this number (4.250). From table, temp table, variable table or hardcoded value. Rounding and casting is absolutely the same in all cases. -- normal table CREATE TABLE [dbo].[value] ( [val] [decimal] (5, 3) NOT NULL ) INSERT INTO [value] VALUES (4.250 ) SELECT ROUND(CAST(val * 0.01 / 12 AS DECIMAL(15, 9)), 9) AS val FROM [value] AS pr -- inline query from normal table SELECT * FROM (SELECT ROUND(CAST(val * 0.01 /

LocalDB parent instance version invalid: MSSQL13E.LOCALDB

倾然丶 夕夏残阳落幕 提交于 2019-12-03 11:37:50
问题 I'm unable to add a database on a developer machine. I'm running win 10, visual studio 2015. I re-installed SQL server 2016 twice, last time with firewall disabled it all gave green marks in the end. While i can create databases in VS2015 SQL server object explorer. I am unable to add a SQL database(S) to my projects, trough solution explorer. Each time i try to add a database to a project i get event 527 SQLLocalDB 12.0 LocalDB parent instance version is invalid: MSSQL13E.LOCALDB I've tried

how to detect sql server timeout from .NET application without using catch Exception

雨燕双飞 提交于 2019-12-03 05:19:57
问题 In my current application, i am performing an update by invoking T-SQL Update command. The problem is when the same record is locked by other users at that time. At .NET application, the application will wait until SQL Server timeout, then it will throw the SqlException timeout. Is it possible to perform a check first whether a particular record is locked by other process rather than catching the exception ? 回答1: No, not really. The standard way is to use try/catch and handle SqlException

LocalDB parent instance version invalid: MSSQL13E.LOCALDB

大憨熊 提交于 2019-12-03 02:00:01
I'm unable to add a database on a developer machine. I'm running win 10, visual studio 2015. I re-installed SQL server 2016 twice, last time with firewall disabled it all gave green marks in the end. While i can create databases in VS2015 SQL server object explorer. I am unable to add a SQL database(S) to my projects, trough solution explorer. Each time i try to add a database to a project i get event 527 SQLLocalDB 12.0 LocalDB parent instance version is invalid: MSSQL13E.LOCALDB I've tried Start > Run > cmd > sqlcmd -L and it shows my SQLserver Also made sure it uses the right ports as by (

Error when trying to pass comma separated values in SQL Server 2016

[亡魂溺海] 提交于 2019-12-02 19:09:41
问题 I am calling this SQL Server stored procedure from another application in this way: EXEC GlobalReminder @documentidnumber = '${@documentidnumber}'; The documentidnumber is a variable that contains comma separated values, for example 7568, 8990, 5523 . It appears that in this format, I am unable to pass multiple values to this parameter and hence this results in an error. CREATE PROCEDURE [dbo].[GlobalReminder] (@documentidnumber NVARCHAR(MAX)) AS BEGIN SET NOCOUNT ON; SELECT SUB, REGION,