I’m trying to retrieve records from a database in Azure and for the checks I run T-SQL queries directly and then pass them to LINQ against the EF Core context, but I’m running into this problem. When I filter for the records with FechaOrientativa greater than or equal to Today, the Estudiar field is equal to ‘pt’, I get 2,296
Tag: tsql
Capturing difference between 2 tables in one table
I understand my mistake with creating questions in StackOverflow, so I want to rewrite my question. I have two tables. One of them is my target table with old data and the source table with new data. Implicitly I want to compare these 2 tables and get information on which columns have been changed and changed status. So I created
cast numbers and decimals into INT
I have [funds] that have been presented in different formats, some are decimals, others numbers: etc I tried to use this: ,CAST (REPLACE ([funds],’.’,”) AS INT) AS [funds] but got this mistake: The conversion of the varchar value ‘288294130100’ overflowed an int column. How do I ned to treat the combo of numbers and decimals? Answer You can cast them
Incorrect syntax near ‘<' in SQL Server Scalar Functions
Here is the requirement: Find all teachers whose FirstName length is less than 5 and the first 3 characters of their FirstName and LastName are the same I tried this query (Scalar Function): To call function: But, when I execute first query, it shows error: Incorrect syntax near ‘<‘. Can anyone help me with this? Answer Just use a normal
Return only the modified records in a table, using T-SQL
I’m attempting to return only the modified records in a table, using T-SQL. This is what I’ve done thus far: Results: Expected results: The following statement returns all the 0 to 1, and 1 to 0 records and I don’t understand why: Answer To track the changes at whole dataset, you were almost there, you just need to remove the
Conversion Failed in a CASE expression
I have a column that is of varchar type, it contains dates and ‘#’: I am trying to convert the dates to the standard date format (YYYY-MM-DD) and leave the ‘#’ as it is whenever it occurs. Here is my code: The outcome column is also of varchar(10) type (same as the original column). I expected to get # whenever
Assistance with PERCENTILE_CONT function and GROUP By error
All, I am having problems with the below query. I am trying to get stat data from our database for the last 3 years but I keep getting the error message: ***Column ‘OC_VDATA.DATA1’ is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.*** I know it has something to
Return distinct results that appear more than once
I have the following data: Result should be: Note that the result find unique combinations of ID and Site that repeat more than once for a given ID. I did the following query but does not return the result: Answer See: DBFIDDLE The SELECT ID, site FROM table1 GROUP BY ID, site will select the distinct values. Then, using HAVING
Search in the database
This Messages form display table with these informations (ID,FROM,TO,TITLE,MESSAGE). I am trying to search for all the messages send to a certain user . user will enter his name in the Search_textBox then it will filter the table to keep only messages to this user. I get this error : Answer this is Correct
How do I insert multiple rows with many to many relations into ‘Table1’ from ‘Table1’?
I’m trying to copy an existing ship, with all of its contents of its child tables (for lack of a better term) and their relations. So far I’ve got most of the copying down except for the ship’s tables that have a many to many relation. An example of my current situation is as follows: I have two individual tables