Category "sql-server"

Are there any advantages in using a single stored procedure for multiple operations or is my teacher wrong? [closed]

I'm working on my databases class final project, which consists of making an application that can access and do operations in a database. My t

Sequelize get data of another column while using Aggregate Function

I'm trying to get data using Sequelize in my Express app and I'm using SQL Server as database. Here is my code: Order.findAll({ attributes:[ [Sequ

Microsoft SQL Server Create a session specific synonym

I am working on a database that hold specific session data in separate tables for each session. e.g. I'd have a table called ProductsABCD, which holds products

Microsoft.EntityFrameworkCore.Internal.DiagnosticsLogger`1'

I m trying to migrate my data base using EF core when i run this commande "dotnet ef migrations add Init --context PersistedGrantDbContext -o Migrations/Persis

Generating xml with SQL Server with child namespace

I am generating an XML using SQL Server and I need the following name space: xmlns:ns0="http://www.w3.org/2001/XMLSchema-instance" ns0:noNamespaceSchemaLocation

Easier way to reverse the order of a canonical name

I'm wondering if there is an easier way to reverse an Active Directory canonical name in SQL. I found a way to do this, but it only works with a set number of O

Why DISTINCT keyword is decreasing my search time and increasing performace in SQL Server

I am new to SQL and SQL Server and I am using SQL server 2012. but recently I encountered a weird thing while working with SQL server. I got that adding DISTINC

How to best use multicolumn index with value ranges in SQL Server?

I'm running SQL Server 2016 Enterprise edition. I have a table with 24 columns and 10 indexes. Those indexes are vendor defined so I cannot change them. I have

How to best use multicolumn index with value ranges in SQL Server?

I'm running SQL Server 2016 Enterprise edition. I have a table with 24 columns and 10 indexes. Those indexes are vendor defined so I cannot change them. I have

EFCore join values

I'm trying to join a big table to a small list of data pairs using EFCore 2.1.1. I want this join to happen server-side, rather than trying to download the who

SSMS Export Query Results to Excel or CSV

I am trying to export the results of a query to CSV and then ultimately Excel. My issue is, one of my columns has commas in it and the commas interrupt Excel

How to find and delete all duplicates from SQL Server database

I'm new to SQL in general and I need to delete all duplicates in a given database. For the moment, I use this DB to experiment some things. The table currentl

SQL - UTF-8 to varchar/nvarchar Encoding issue

Problem background - I am receiving response data from a website, formatted in json and UTF-8 encoded. A body attribute of json has values in a base64binary typ

Storing DateTimeOffset value without milliseconds in SQL Server using EF Core

Say I create a DateTimeOffset value like this: var dt = DateTimeOffset.UtcNow; And I want to store this value in SQL Server using EF Core code-first. How do I

Rolling 12 month Calculation SQL

I am trying to do a 12 month rolling calculation, but I get a syntax error at "rows", here is what I have so far: (SUM(YTDValue) OVER (ORDER BY PerformanceDate

Create View in SQL Server to create multiple rows for each date,with calculated date and identifier column

I need to create a VIEW/Select statement that will take a start date, and create 3 different rows for each date. One row calculates 30 days, from the start date

How can force SQL DateDiff function to stop rounding up?

I am working on a query that tries to count from an exact date to an exact date. Today is 2/16/2022. Between 6/30/2020 and 2/16/2022 19 months have gone by. My

Can we stop SQL Server EXCEPT from ignoring trailing spaces in values

I am auditing values in 2 identical structure tables. The T-SQL EXCEPT statement is ignoring the trailing space on a value in one table, so the values don't mat

Is there any way to track changes from views in MS Sql Server?

I'm looking for how to track changes from a view in MS Sql-Server 2012. And, the role of the log-in user is Public. So, it's hard to do it. For example, Assumi

I want to create a store procedure that will create DDL,DML trigger for a selected table as parameter

Like the below trigger but I need to add update insert and delete all three. for update trigger columns dynamically getting is not able to code CREATE TRIGGER d