Category "sql"

Can I do a DAG with SQL Server HierarchyId?

I'm developing an organizational chart in SQL Server 2016. I have some employees report to multiple managers which make the data structure a Directed Acyclic Gr

Mssql loop with UNION t-sql

I just use Mssql procedure given at this site Using loop with UNION t-sql to build my own loop procedure. When I'm executing this code: SELECT '[hpsdb].[

JPA, get all elements

I'm using JPA and I get all elements from DB in this code: factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME); EntityManager em = factory

How to Identify port number of SQL server

I Install SQL server in my system and I have to check on which port number SQL is working in my system

CONCAT_WS() for SQL Server

How can I emulate MySQL's CONCAT_WS() function in SQL Server? This function is similar to CONCAT() function in SQL Server 2012 except that it adds a separator

How to merge rows by a similar column via levenshtein distance

I'm using AWS Athena and I'm trying to merge all the rows which have a specific column with levenshtein_distance value lower then 5 and sum the normalised perce

SQL to convert multiple rows into a single row of variable length

I am writing a module for drupal6/PHP5 using MySQL (and optionally PostgreSQL). To represent arbitrary sample properties and instrument readings in an experimen

Procedure or function expects parameter which was not supplied, when parameter is auto-generated

I'm trying to insert data in my db. this is the code im using SqlCommand cmd = new SqlCommand("dbo.UsersInsert", cnn); cmd.CommandType = CommandType.StoredPro

Conditions (like "like") on binary field (blob) in oracle

How can I search in (put condition on) blob field in oracle, like text fields? I need someting like: select * from table_name where blob_field like '%00ff00ff

To take out those dept who has no employees assigned to it

I want to write an sql query , and want to get the dept name from DEPT table who has no employees assigned in EMP table. Table Structure: EMP EMPNO ENAME

Join the same table temporary table in MySQL

I like to join a temporary table in MySQL which fails, the idea quite simple: CREATE TEMPORARY TABLE temp_table LIKE any_other_table; -- srsly it does not matt

phpMyAdmin Accepts NULL in the NOT NULL field

I've created a table with some NOT NULL columns using phpMyAdmin. CREATE TABLE `TEST` (`ID` INT PRIMARY KEY AUTO_INCREMENT, `Firstname` V

Short-circuit UNION? (only execute 2nd clause if 1st clause has no results)

If I do: SELECT * FROM A WHERE conditions UNION SELECT * FROM B WHERE conditions I get the union of the resultset of query of A and resultset of

Grouping into interval of 5 minutes within a time range

I have some difficulties with mySQL commands that I want to do. SELECT a.timestamp, name, count(b.name) FROM time a, id b WHERE a.user = b.user AND a.id =

Connection to SQL DB with Cypress

I'm trying to connect with SQL db using cypress followed the NPM guide . All the dependencies are exactly as mentioned but on running this cy.sqlServer('SELECT

Connection to SQL DB with Cypress

I'm trying to connect with SQL db using cypress followed the NPM guide . All the dependencies are exactly as mentioned but on running this cy.sqlServer('SELECT

SQL Server Maximum rows that can be inserted in a single insert statment

I want to do a batch insert, similar to this question How to do a batch insert in MySQL What is the limitation is SQL Server on how many rows can be inserted

How to Dynamically Name Table in Oracle SQL Select Statement?

i would like to return all rows and fields from a table, where neither the tablename nor the fieldnames are known in advance. Something like: select * from [TA

Query returns function plus the value inside instead of just the value

I'm running a select query and for fetching date and time data from the database but for some reason the returned value is datetime.date(2021, 11, 18) and datet

Check the perm 'Create Database' in PostgreSQL as well as in SQL Server

I would like to check the perm in PostgreSQL db as well as I do it via this command 'SELECT HAS_PERMS_BY_NAME(NULL, 'DATABASE', 'CREATE DATABASE')' for the SQL