sql-server-2014

How do I show balance log in a gridview

爱⌒轻易说出口 提交于 2019-12-11 03:44:02
问题 I have a system in which allows the user to apply for taking leaves. The system also credits leaves to each user's account, twice a year. Now, the administrator has full authority over this whole system and, can cancel the and grant leaves. To analyze whether a user has not exceeded all privileges extended to him, it is required that the admin should be shown a record of the credit and debit of leaves taking place in each user account, like a log. Something like this: Now, I have made a table

How do I configure other user defined data-type with Entity Framework Core?

强颜欢笑 提交于 2019-12-11 02:23:19
问题 I'm using scaffolded entities with Entiy Framework Core 2.1. The 3rd party database uses some unser defined data types (that I didn't know about) that don't seem to be recognized by EF-Core. According to The Fluent API HasColumnType Method and Reverse Enginer: Support type aliases (user-defined data types) this should work. However, I'm not sure if only for precofigured/built-in types like Name or any types. The engine generates this entity.Property(e => e.Status).HasColumnType("Enumeration")

How to get comma delimited CategoryIds recursively?

 ̄綄美尐妖づ 提交于 2019-12-11 00:16:25
问题 I have a table like this: Name CategoryId ParentCategoryId Footwear 93 0 Men Shoes 6 93 Female Shoes 7 93 Mobile 2 0 Smartphone 4 2 I need output like: Name Categories Footwear 93,0 Men Shoes 6,93,0 Female Shoes 7,93,0 Mobile 2,0 Smartphone 4,2,0 Basically, I need to recursively get the category ids and make them into a comma delimited string. I am getting into SQL after 3 years now and I have no idea how to get this result. I have tried solutions from other SO questions but still no luck.

Extract Data by comparing 4 different rows

孤街醉人 提交于 2019-12-10 23:58:43
问题 The Table data is as below, need to extract records that met the below conditions Here Value = Value2-Value1 Value of two days back data should be > 2 Value of last day data is < 0 Value of next day data is < 4 and >0 Value of after next day data > 4 All the dates are weekdays,if any date falls on friday, need to compare with next day ie.. Monday. and comparision is with alternative days only from below output have to be. 1 4-1-2018 15 18 2 3-1-2018 3 0 -----------------------------------

The metadata could not be determined because every code path results in an error; see previous errors for some of these

别来无恙 提交于 2019-12-10 19:46:39
问题 I am migrating from SQL Server 2005 to SQL Server 2014 and one of the queries stopped working in SQL Server 2014: select * from openrowset ('SQLOLEDB','Server=(local);TRUSTED_CONNECTION=YES;',' exec [MyDatabase].[dbo].[MyTable]') I get the following error message: Msg 11529, Level 16, State 1, Procedure sp_describe_first_result_set, Line 1 The metadata could not be determined because every code path results in an error; see previous errors for some of these. Msg 4902, Level 16, State 1,

SQL SERVER 2014 Code Snippets missing

时光怂恿深爱的人放手 提交于 2019-12-10 16:51:59
问题 I'm trying to use the Snippets functionality in SQL Server. I'm testing out adding new snippets to SQL Server 2014 following the instruction here. Everything works fine except that after I added the snippet, it doesn't show up in the IntelliSense. Even more, I realized that not all build-in Snippets are showing up. I wonder if anyone else has the same experience, and knows how to resolve this? This is a list of build-in snippets under Function And this is what I see from IntelliSense (3 of

Does `sp_executesql` really accepts the `nvarchar(max)` argument?

假如想象 提交于 2019-12-10 15:34:35
问题 Summary: The EXEC sp_executesql @code fails for the content longer than 4000 in the @code , but the @code is not truncated to 4000 unicode characters. I am observing the problem on SQL Server 2014 Developer Edition. More details: my SQL installation script defines some code dynamically because it should modify the code so that it reflects the environment (only once, during the installation). Let the following @datasource variable captures results for the specific environment: DECLARE

Missing Reporting Server templates in Visual Studio 2013 + Business Intelligence SSDT

非 Y 不嫁゛ 提交于 2019-12-10 14:49:22
问题 The other day I have installed Microsoft SQL Server Data Tools - Business Intelligence for Visual Studio 2013 (SSDT: Replacement for BIDS) and started using reporting features in VS2013 . Successfully created a project using Report Server Project Wizard template. However, later on I needed SQL Server 2014, then I downloaded and installed the developer edition. (in case if this might've caused the problem) Now the Report Server Project templates are missing from VS2013 and I can't simply bring

Merge Start And End Columns To One Column

怎甘沉沦 提交于 2019-12-10 13:45:39
问题 I have searched high and low for weeks now trying to find a solution to my problem. My problem is as follows: A have a table with start and end co-ordinates and dates from a vehicle telemetry provider. I need to merge these into one column in order for our reporting solution to be able to plot them. Some example data is as follows: DECLARE @TblVar AS TABLE([ServiceID] INT ,[StartDate] DATETIME ,[StartLocation] VARCHAR(255) ,[StartLat] FLOAT ,[StartLong] FLOAT ,[EndDate] DATETIME ,[EndLocation

SQL Hierarchy - Resolve full path for all ancestors of a given node

天大地大妈咪最大 提交于 2019-12-10 13:27:02
问题 I have a hierarchy described by an adjacency list. There is not necessarily a single root element, but I do have data to identify the leaf (terminal) items in the hiearchy. So, a hierachy that looked like this ... 1 - 2 - - 4 - - - 7 - 3 - - 5 - - 6 8 - 9 ... would be described by a table, like this. NOTE : I don't have the ability to change this format. id parentid isleaf --- -------- ------ 1 null 0 2 1 0 3 1 0 4 2 0 5 3 1 6 3 1 7 4 1 8 null 0 9 8 1 here is the sample table definition and