Category "sql"

BigQuery sort a CONCAT of multiple string columns in SELECT

First I will present example of what I'm trying to achieve, and then will share a bit more info. This is a relatively straightforward task to explain, however I

Using a SELECT statement to return a row where a DateTime column = variable of type Date?

I am using OleDb, trying to do this: Dim d as Date = DateSerial(Year(rptDate), Month(rptDate), 1 - 1) Dim conn as OleDbConnection = new OleDbConnection(connSt

SQL Geography point inside polygon not returning true on STIntersect (but returns true using Geometry)

I don't want to resort in converting my geography data to geometry just so it returns true in STIntersect. Here is the code in SQL: DECLARE @point GEOGRAPHY =

postgresql: INSERT INTO ... (SELECT * ...)

I'm not sure if its standard SQL: INSERT INTO tblA (SELECT id, time FROM tblB WHERE time > 1000) What I'm looking for is: what if tblA and

SQL Geography point inside polygon not returning true on STIntersect (but returns true using Geometry)

I don't want to resort in converting my geography data to geometry just so it returns true in STIntersect. Here is the code in SQL: DECLARE @point GEOGRAPHY =

Impossible to add a User-Defined-Data Type parameter to my query

I'm trying to use a User-Defined-Data Type with C# and SQL Server 2008 but I have an exception raised when command.ExecuteReader() is executed. string qyery

Dynamic Column Name for a Derived Column - ORACLE SQL

I'm trying to set a dynamic column name on my query using "select from dual". Is this possible? If not, kindly recommend alternatives for me to achieve this. I

Dynamics NAV SQL Lead Time format conversion

I have a small issue getting data, one field in particular, from table replicated from Microsoft Dynamics NAV. There is a field storing lead time in strange fo

Python BeautifulSoup Empty Rows in CSV File

I am working on a scraper to pull street names and zip codes from a site and all of that is working great and it builds a CSV file just fine for me. But when I

Database design, variable number of columns [closed]

I have a simple application in which users submit data into a table. There are currently 3 fields the user can pass values to at the moment.

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