Category "sql"

Getting output of MS stored procedure on php call

I am using the sqlsrv ms drivers for php, which work fine (tested with normal queries). I have also tested it with running a stored procedure to update a table

Function Based Index not improving query performance

I have created view and in this view i have added the below case statement which i need and for which i already create exactly the function based index. The vie

How do I loop through an MS SQL database with VB.NET?

I'm trying to implement the following php code in visual basic. I wrote it in PHP because I knew I could do what I wanted to in that language, but I can't for t

how to get Arabic Month Names in sql?

I am trying hard to get the 12 months names in Arabic , I tried a lot but nothing work. any help ?

Why time format is changing in Azure Databricks

I have a file with a timestamp with time format as 2017-01-20 16:53:05.212 (yyyy-MM-dd HH:mm:ss.SSS). I have uploaded this file to Azure data lake gen 2 and acc

List the details of employee ,department with a reference column

Here I have 2 tables, Employee and Department, and the data as follows. Employee: Empid Empname Deptid salary ----------------------------------------- 1

Create PostgreSQL ROLE (user) if it doesn't exist

How do I write an SQL script to create a ROLE in PostgreSQL 9.1, but without raising an error if it already exists? The current script simply has: CREATE ROLE

SQL Server stored procedures don't refresh even after refresh

Anytime I'm editing and debugging a SQL Server stored procedure, I'll make the changes, then refresh all along the line. I'll refresh folders: Stored Procedures

Select last n rows without use of order by clause

I want to fetch the last n rows from a table in a Postgres database. I don't want to use an ORDER BY clause as I want to have a generic query. Anyone has any su

Generate random int value from 3 to 6

Is it possible in Microsoft SQL Server generate random int value from Min to Max (3-9 example, 15-99 e.t.c) I know, I can generate from 0 to Max, but how to inc

sequelize destroy record with join

In my model there is a Users table, and a UserPhones table. User.id is a foreign key in UserPhones. module.exports = (sequelize, DataTypes) => { const Use

How to set auto increment primary key in PostgreSQL?

I have a table in PostgreSQL with many columns, and I want to add an auto increment primary key. I tried to create a column called id of type BIGSERIAL but pgad

How can I select rows where keeping only those that meet this criteria? sql/hive

I have a table like the following: +-------+------+ |ID |lang | +-------+------+ |1 |eng | |1 |pol | |2 |eng | |3 |gro | |

SSMS 2012: Convert DATETIME to Excel serial number

I can't seem to find an answer to this anywhere --- I want to convert a datetime in SQL to the excel serial number. I'm essentially looking for the DATEVALUE f

How to order results of a query by the results of an aggregate function in ComosDb?

I use Cosmos Db and I need results to be sorted by the results of a COUNT. Instead of sorting the results each time myself (or create a service for it), I pre

User defined table type with dynamic columns in SQL Server

In my .NET (C#) win application, I import an Excel file that contains multiple columns of varying numbers. So, I store the data in my datatable in code and I ne

SQL Query Error - Error Source: .Net SqlClient Data Provider

Error Message: The SELECT permissions was denied on the object 'quote', database 'oneview', schema 'dbo'. I am relatively new to SQL and the developer I am le

how to solve db2 code: -104, SQL State: 42601

--/ BEGIN FOR V AS MYCURSOR CURSOR FOR SELECT ID,NAME,AGE FROM PEOPLE DO BEGIN INSERT INTO PERSON(NAME,AGE) VALUES(V.NAME,V.AGE);

How to query database by id using SqlAlchemy?

I need to query a SQLAlchemy database by its id something similar to User.query.filter_by(username='peter') but for id. How do I do this? [Searching over Googl

Insert radio button selected value into database

I am building a C# Windows application with 2 radio buttons for gender. I'm using a simple insert query to insert data in the database. Can anyone help me wit