sql-server-2016

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

感情迁移 提交于 2021-01-28 09:35:30
问题 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

Create a column to calculate the portion of balance for every shipment according to FIFO

此生再无相见时 提交于 2021-01-05 12:36:14
问题 I have a query to get Stock-items with it's Balance and Its receiving Transactions cods with its quantity Ordered By date, And i Want to create a column which has only the proportion Balance of every RS Code according to First in First Out Principle. As An Example in the attached sample we have StockItemId = (2222,2262,2263). and the expected result will be AS: As in Pic the Balance of every row in RS_Portion is depending on the Quantity of the Code and the sum of RS_Portion of every item

Script Task Corrupt - SSISDB execution error after upgrading from SQL Server 2016 to SQL Server 2016 SP2

*爱你&永不变心* 提交于 2021-01-04 05:42:18
问题 We recently updated our production SQL Server 2016 Enterprise instance from SP1 to SP2. We are currently on version 13.0.5026. Prior to the upgrade, a user with connect rights to SSISDB and proper rights on the Integration Services Catalog folder could deploy an ISPAC file successfully. After the upgrade, the same users can still deploy to the SSISDB, but when you execute the .DTSX , the script task inside fails validation. If I deploy the exact same ISPAC as a sysadmin, there's no issue. The

Get data from every column in every table in a database | SQL Server

隐身守侯 提交于 2020-12-06 12:03:57
问题 I have seen multiple questions on how to retrieve every column from every table along with its data type, among many other pieces of information which can be summarised in the shortest way with this query: SELECT * FROM INFORMATION_SCHEMA.COLUMNS However, is it possible to get all the data from the columns and the rows they belong to get the first row in the table alongside this? I have not found a way to do so thus far. Is it possible to do such, maybe also having a WHERE condition such as

Get data from every column in every table in a database | SQL Server

一曲冷凌霜 提交于 2020-12-06 11:57:18
问题 I have seen multiple questions on how to retrieve every column from every table along with its data type, among many other pieces of information which can be summarised in the shortest way with this query: SELECT * FROM INFORMATION_SCHEMA.COLUMNS However, is it possible to get all the data from the columns and the rows they belong to get the first row in the table alongside this? I have not found a way to do so thus far. Is it possible to do such, maybe also having a WHERE condition such as