sql-server-2016

SQL Server Count records from parent category and all subcategories

岁酱吖の 提交于 2021-02-07 19:48:14
问题 Currently I have a stored procedure where I create a table and query the table to get my desired result, the result being an infinitely tiered child/parent table that allows me to display the data on my ASP Classic based webpage. This procedure is: SET NOCOUNT ON; DECLARE @Categories TABLE( CatID INT NOT NULL, CatName VARCHAR(200) NOT NULL, ParentID INT ) INSERT INTO @Categories SELECT CatID, CatName, ParentID = NULL FROM Categories WHERE CatName NOT IN ( SELECT CatName FROM Categories c

SQL Server 2016 always encrypted - comparison and calculated expression using always encrypted column in view

痞子三分冷 提交于 2021-02-05 06:49:11
问题 I have a column "Amount" numeric(18,2) that I have made encrypted by using Encrypt Column wizard of SSMS v17. The column data is now encrypted. However, I have a view that uses something like: create SampleView as Select *, Amount * Rate as TotalAmount From SampleTable Where Amount > 0 go The column Rate is of type numeric(18,8) . I am unable to create this view. It gives data type incompatible error as one column is encrypted and the other side is plaintext. From various permutation I have

Microsoft dynamics Mediaset Datatype and SSRS

只愿长相守 提交于 2021-01-29 21:48:56
问题 I have a table called Item in Microsot Dynamics (NAV). One of the requirement is to display a picture that is attached to the item. The SQL datatype of this field is "uniqueidentifier". However, when looking at the development environment for dynamics, I see the following: How do I retrieve and show this image in an SSRS report please? 回答1: For any one looking at this. Navision Dynamics stores images as Mediasets. These references are stored in the [Tenant Media Set] table and the actual

SQL Query get most recent activiy per account (efficient query)

隐身守侯 提交于 2021-01-29 20:09:16
问题 I use MS SQL Server 2016 and try to query the MS Dynamics 2016 on-premise DB efficiently. You don't need special knowledge about Dynamics to answer my problem because it's rather an SQL but a CRM problem. Suppose you have entities FilteredAccounts and FilteredActivities (that's the name in Dynamics View) FilteredActivites have the following columns: accountid name FilteredActivites have the following columns: activityid actualend [DATETIME] regardingobjectid (referring to account) statecode

Is it possible to have a distributed transaction with IBM MQ and SQL Server in .NET5?

不问归期 提交于 2021-01-29 15:47:12
问题 We are thinking of migrating from .NET Framework 4.0 to .NET 5. In our code we often get a message from an IBM MQ Queue and write it to the database in one transaction, or we read and update the database and write to an IBM MQ Queue in one transaction. The code runs on Windows Server 2012, the database is SQL Server 2016 and we have IBM Websphere version 8.0. The distributed transactions are coordinated by MSDTC. Is it possible to do the same with .NET 5? As far as I know, .NET 5 does not

Cannot create a task from xml for task Azure Blob Download Task. Error 0x80070057 the parameter is in correct

旧时模样 提交于 2021-01-29 09:22:46
问题 We have implemented an SSIS package which downloads the file from Azure blob storage. The package works when we execute from local development box. But it's failing on TEST environment. This was working earlier both local and TEST environment. We couldn't figure out what went wrong recently. Can somebody help us here? Following are the software components we have installed. SQL Server Version: 2016 SSDT : Microsoft SQL Server Data Tool Visual Studio 2017 Service Feature Pack: SQL Server 2016

SQL agent job failed with an error 0x80131904

☆樱花仙子☆ 提交于 2021-01-29 07:23:50
问题 I have one SQL agent job that executing the SSIS package. When the job is running through schedule then it is giving an error: Failed to execute IS server package because of error 0x80131904. Server: XXXXX Package path: "XXXX" Environment reference Id: 2. Description: The operation failed because the execution timed out. But when I manually running the job by right clicking on it then the job runs successfully. Could anyone help me on this to find out the root cause and solution of the issue.

Flag Records with highest version number within calculated field/calculated column as “true”, rest as false

北城以北 提交于 2021-01-29 06:04:00
问题 Environment: MS SQL Server 2016. I have a table which contains (Jasper Reports) layout representations like this (only relevant fields shown for brevity): ID Name Key Version 1 CoverLetter <guid1> 1.00.00 2 Contract <guid2> 1.00.00 3 CoverLetter <guid1> 1.00.01 Goal: I need an additional calculated field which is set to true or false according to whether the record is the highest version of any given Layout or not (Same layout but different versions have same key, different layouts have

How to determine if given table is memory optimized?

醉酒当歌 提交于 2021-01-29 03:08:17
问题 Good morning, My first question is how to determine if tables created in MS SQL Server are memory optimized. I have some tables and I don't remember if some of them I created in-memory optimized or not. Many thanks for answers. 回答1: To riff off of another answer here, here's a way to get the status for all tables in your database: select name, OBJECTPROPERTY(object_id,'TableIsMemoryOptimized') from sys.tables; Similarly, if you want just the in-memory ones, you could do: select name from sys

Wrong object_name and definition relationship in sys.sql_modules and sys.objects

不想你离开。 提交于 2021-01-28 09:35:56
问题 I ran the following query SELECT sm.object_id, v1.object_name, o.type, o.type_desc, sm.definition FROM sys.sql_modules sm CROSS APPLY (VALUES (OBJECT_NAME(sm.object_id))) v1 (object_name) JOIN sys.objects o ON sm.object_id = o.object_id; And there are three objects with a wrong relation between object_name and definition . There is no match, no correspondence between the name and the definition it references. It looks like this tables didn't track the delete or changes in name and definitions