Category "sql-server"

How do I recursively select rows where values in one column are present in another column?

I have a table like below with two columns Person and Supervisor. Person Supervisor 1 3 2 3 3 4 I want to select rows where the Supervisor column only has val

What is the data type in ASP.NET Core for decimal(18,2) in sql

I have a Amount column in database which is in Varchar datatype, I am retrieving the data from table and I am casting for the amount should be returned as (123

Lookup value in Query

I'm trying to replace the local variables i've declared below to capture them in calculated columns. So the [YTD] column would look up Today's Date - 1 and retu

Porting Xamarin tutorial over to .NET MAUI

For my first ever mobile app project (which will eventually become an actual commercial project), I would like to try out .NET MAUI. Unfortunately since it's s

SqlException while initializing database, but only on Azure and only with CF Migrations

I'm getting a SqlException when running initialization against an Azure SQL Server database: The server was not found or was not accessible. Here's my Context c

SQL If Value Exists then return that otherwise return whole table

Note: This is an over simplified version of what I am trying to do. Let's say I have a table called USERS that has FIRSTNAME, LASTNAME. Contents are: JOHN SMI

SQL Server Trigger After Insert is Repeating old valus

Can someone please explain why this trigger would start failing and insert the same record repeatedly? It seems as though there is something wrong with the vari

I have an error when creating a search and list view for my app

My app is linked to a microsoft server which has tables with employee names that need displayed on the app when searched. I also want whenever a letter is typed

SQL Server combine case with convert statement

Hi im stuck with this query, what i want is to get one column "fecha_registro_convertida" with the condition of the case statement but also with the CONVERT sta

Create table from simple UNION statement

What is wrong with this union? first 'select' and ')' are incorrect create table GL_ALL ( select *from GL1 ) UNION ( select *from GL2 ) UNION ( select

Is it possible to install mssql-tools in raspberry pi (ARM)

I'm trying to use a raspberry to make backups of a SQL server and upload the file to the cloud, however, I don't know if it would be possible to do this due to

Sql determine rows that dont have value

I have a table that returns results like abc yes abc no cdef no cdef no cdef no xyz yes xyz no xyz no sample query with abc as( select 'abc' as b

SQL Query with 2 conditions but from different tables

I have the below query that has only one condition, which is if the companies are included in the table, then mark them as "Yes" under [Competitor] column, if t

How to prevent automatically rounding the decimal part of the number in .NET 6

After I converted the version from .NET Core 3.1 to 6.0, I figured out that all decimal(10, 5) type columns were automatically rounding the decimal part of the

SQL Server backup using powershell in Task scheduler

I am using PowerShell to backup a SQL Server database and use Windows task scheduler to schedule the script Test Run the script manually, it works. Both SQL Ser

SQL Error when using Order By for SQL database query in PowerBI Desktop

Getting this error when using Get Data with PowerBI Desktop to connect to SQL database Microsoft SQL: The ORDER BY clause is invalid in views, inline functions,

SSRS 2017 configuration and Installation

I have SSMS 2017 and VS 2019. I was trying to configure SSRS 2017. It says: The database engine instance you selected is not valid for this edition of report s

PK on temp table failing

I have a trigger which declares a table variable. DECLARE @TREarn_aaa table ( aaaID bigint NOT NULL PRIMARY KEY, Bbb decimal (18, 8) NULL, Ccc dec

Is there a faster way to find the order of a COLUMN?

My SQL Server table looks like this ID a_Toyota a_Mazda a_Nissan a_Kia a_Honda a_Subaru SoldCar CarOrder 1 8000 7000 6200

SQL question using PIVOT, no aggregation column

I would like to do a PIVOT on my table but I don't have aggregation column. SELECT CONVERT(date, DataHora) AS dia, CONVERT(VARCHAR(5), DataHora, 108) A