I am trying to insert basic data into my MSSQL database but I keep receiving this error: System.Data.SqlClient.SqlException: ‘Invalid column name ‘Common’. Invalid column name ‘Bug’. Invalid column …
Tag: sql
Specified Twice Table for ‘DELETE’ in MariaDB
I created a query to delete some record in MariaDB Query : Result : Table ‘HrAttLogsFormatted’ is specified twice, both as a target for ‘DELETE’ and as a separate surce for data But with the query I made unsuccessfully, is there a way to solve it? Thank you in advance [EDIT-SOLVED] It&…
Convert Raw SQL ‘NOT’ IN (too slow) to Laravel Eloquent
I have a running script using Raw SQL in Laravel 5.3 controller which I found it slow and not secure ( as Raw ). If there any way to make it more effecient and convert it to eloquent or Query Builder …
How do I populate a foreign key field with data instead of just foreign key id on select query?
I have 2 tables with class and subjects. class(id,name,student_count) subjects(id,name,class_id) I want to populate class_id with name,student_count, and id on the select query. How do I do this using SQL or Knex? I tried using join, but I get only one field not all fields in a row. The expected result would …
Get Sequence Current Value
I have a created sequence on my DB Server, used for generated registers and the detail of every one. I have to create a plain document of that detail in the moment of the generation, so I have to …
Create new rows based on condition – Oracle SQL
I have a table ID ID2 VARIABLE VA_VAL 1 100 F_NAME ABC 1 102 QUAL 01 1 103 CODE 1923 2 100 F_NAME BCD 2 102 QUAL 02 2 103 CODE 2034 3 100 F_NAME CDE 3 …
SQL Cross-Schema stored procedure permission issues
Given a simplified stored procedure CREATE OR ALTER PROCEDURE [FooSchema].[Foo] AS SELECT B.*, FROM [BarSchema].[Bar] AS B WHERE […] After granting EXEC to a user on the FooSchema, but …
Split CLOB column based on new line – Oracle SQL
I have a table table1 f_name f_content test1.txt YL*1**50*1~ RX*1~ LR*2~ test2.txt YL*1**49*1~ EE*1~ WW*2~ f_content is CLOB f_name is varchar2 (…
How retrieve all parent and child rows population in Oracle sql?
I have a table “TB_Population” with some records about the population from all over the world. at this time I want to calculate each title’s population in particular row and demonstrate each level in …
Selecting an attribute that has max value for another attribute
**** Edit: How do I also consider the case where there is more than one property with the highest value? I’m trying to write an outer query that takes the propertyname with the highest value from an …