sql

Access/SQL Server 2008 Join using Like not working

安稳与你 提交于 2021-02-19 08:04:56
问题 I apologize ahead of time because this question is in various forms many times on this site, but none of the solutions I have tried implementing seem to work properly, and I cannot find an answered question that gets me the right answer. I am working in access for a co-worker, though it will probably be in SQL in the future once he can get a server set up. I am trying to join two tables using Like, which is easy enough, except that it just is not working properly. First, an example from each

EF Core 3.1.1 Avoiding the exception “The data types text and varchar are incompatible in the equal to operator” just as LINQPad 6 does

Deadly 提交于 2021-02-19 08:04:09
问题 I am trying to run this LINQ expression through Entity Framework Core 3.1.1. using (Text3Context text3Context = new Text3Context(_constringText3)) { var aus = text3Context.Ausschreibungen.Where(a => a.InhaltKurzText.Contains(value)).Select(c => c.InhaltKurzText).ToList(); } Unfortunately it throws the exception: "The data types text and varchar are incompatible in the equal to operator" however, when I run the same expression in LINQPad 6: string value = "test"; var aus = Ausschreibungen

SQL Server 2016 with Row Level Security - Addressing the Bottleneck

我的梦境 提交于 2021-02-19 07:59:08
问题 I'm developing with Microsoft SQL Server 2016, and are currently facing a major performance drop when adding Row Level Security (RLS) to my database. I already think I've found the issue, which is Mr Query Optimizer who doesn't like my non deterministic filtering function very much. My question is if anyone had any experience with RLS, filtering functions, and optimizing a case like this. - Can indexing, a more clever RLS filtering function, etc improve the performance? I use RLS to filter

How to UPDATE table with SUM() and COUNT() in same table to different columns

孤者浪人 提交于 2021-02-19 07:53:18
问题 I currently dont do this for my webpage for displaying data from the table, and it is now taking longer to load the page as more and more data enters the database making the query time consuming. In my head, I am looking to update a table as follows so that I am just querying the table and not running additional arrhythmic on the contents via SELECT functions. I was planning to run something like this in a while loop to cycle all iterations of the user variable. UPDATE table SET total = SUM

How to build an editable form with data equivalent to a join?

≯℡__Kan透↙ 提交于 2021-02-19 07:47:26
问题 I have a table Tbl as follows: +----+------+----------+ | ID | Item | ItemDate | +----+------+----------+ | 1 | xv | 7/23 | | 2 | drc | 3/15 | | 3 | fna | 3/15 | | 4 | fna | 1/19 | +----+------+----------+ A user has requested a form TblForm based on this table that includes a column maxDate that gives the most recent ItemDate for each Item . The form must allow the user to edit Tbl data, so I can't just build a form based on a join query, as Access doesn't allow you to edit the results of a

Calculate Percentages In Query - Access SQL

匆匆过客 提交于 2021-02-19 07:42:31
问题 I'm trying to quantify some things. Here's a sample (simplified of course): tblParent: { Number, Name } tblChild: { Number, Name, ParentNumber, Criterion } I'd like to count the total number of Children with the same ParentNumber (easy using a Group By and a Count(1) ), but the problem is comparing that number with the number of children with the same ParentNumber who have Criterion = "Something" . Here's what I have so far: SELECT "Criterion = 1" AS CritDesc, COUNT(1) AS Total, ParentNumber

SELECT Only one value per ID - SQL Server [closed]

烂漫一生 提交于 2021-02-19 07:33:39
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago . Improve this question I dont know is this is possible at all, I´m not even sure how to google it. Im using SQL Server 2014. Right now I have a SP that outputs a table with data including MovementID, Vehicle, VehicleType and Total of sales. But it groups all the vehicles ids and vehicles types with a

EF Migrations drops index when adding compsite index

偶尔善良 提交于 2021-02-19 07:01:50
问题 I noticed EF removed an index on a foreign key when I added a composite index with the foreign key. So I need to understand composite indexes better :) I added the composite index using this answer and generated my EF code first migration file. Adding composite index: this.Property(x => x.Name) .HasUniqueIndexAnnotation("IX_UniqueNamePerKey", 0); this.Property(x => x.TeacherId) .HasUniqueIndexAnnotation("IX_UniqueNamePerKey", 1); Migration file: public partial class CompositeIndex :

Is it true that using INNER JOIN after any OUTER JOIN will essentially invalidate the effects of OUTER JOIN?

﹥>﹥吖頭↗ 提交于 2021-02-19 06:56:43
问题 In other words, for a nested/multiple JOIN SQL statement, is it safe to say that one should always use INNER JOIN first (either put it at the top line or by using parentheses to first INNER JOIN two tables) and make sure it precedes any OUTER JOIN ( LEFT , RIGHT , FULL )? My understanding is that matching columns (e.g., Primary Key column and Foreign Key column) usually don't have NULL values. And any non-matching rows including NULL from an OUTER JOIN result would be removed when being INNER

Ad hoc updates to system catalogs are not allowed in SQL Server 2012

时光怂恿深爱的人放手 提交于 2021-02-19 06:56:06
问题 I want to remove identity from a column by updating it like this.. sp_configure 'allow update', 1 go reconfigure with override go update sys.syscolumns set colstat = 0 -- turn off bit 1 which indicates identity column where id = object_id('tbl1') and name = 'ids' go sp_configure 'allow updates', 0 go reconfigure go I am getting this error, tried many times. Msg 259, Level 16, State 1, Line 15 Ad hoc updates to system catalogs are not allowed. 回答1: If you want to get rid of it completely, just