Category "sql-server"

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

Getting timeout error - increase the send timeout value on binding

WCF service returns timeout error as below. The request channel timed out while waiting for a reply after XX:XX: XX increases the send timeout value on binding.

MS SQL: extremely slow query with 4 OR condition, but each condition alone run very quickly

I have two physical tables: notTempBaseLine with 50k records (index on Version, SrcDimension2_) notTempTrans with 400k records (index on BaseLineVersion, Dimens

SSIS - package works in VS, fails with "Failed to compiled scripts contained in the package". There are no script objects in the package

VS2017, Deploy to SS2016. Package runs without any errors from VS. Project deployment to a server that previously had package deployments only - we're moving to

Using variable arrays in models

Is it possible to define an array in the vars section and use it inside the SQL syntax of a model? Something like this dbt_project.yml: vars: active_country_c

SSIS Alternatives to one-by-one update from RecordSet

I'm looking for a way to speed up the following process: I have a SSIS package that loads data from Excel files on a weekly basis to SQL Server. There are 3 fi

ADF copy activity - ignore the new columns in source without throwing an error

I have a pipeline that copies data from source (dynamics) to SQL server datawarehouse. There is a ForEach activity which iterates over the list of all the table

"Authentication failed for user" when running prisma db pull on a SQL Server database

I am trying to import a SQL Server database into prisma using to prisma db pull command. I created a new DB user with proper rights (that I can log in to SQL Se

Connectionstring: is it the right form?

I'm new to SQL Database C# projects and I have a problem with connecting to my database in a windows form application which is a single user app and I want to u