Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [sql-server]

All versions of Microsoft SQL Server (not MySQL). Please also add a version-specific tag, like sql-server-2016, since it is often relevant to the question.

0
votes
0answers
40 views

Maintain a large OLTP SQL Database [on hold]

We are migrating a large OLTP database from Sybase to MSSQL Server. Currently this is been tested on Pre-Prod, after the bcp and inserts to SQL Server the database size is about 3.5TB (and it grows in ...
2
votes
1answer
51 views

CTE Query to CONCAT text (over 10,000 rows)

I am trying to construct a CTE query to loop through rows of data and concatenate text into one line for each SampleUserNumber. Below is what I am working with: CREATE TABLE #SampleTable ( ...
2
votes
1answer
28 views

What is the strict difference of key and constraint definition in SQL Server?

In SQL Server Keys folder includes primary, foreign and unique keys, constraints folder for example check and default. But unique can also be considered a constraint, so why it is kept under keys ...
2
votes
3answers
112 views

Why does sql server prefer the nonclustered index over the clustered index?

I am trying to speed up a table and as I was experimenting I ran into this (what I think is) odd occurrence. I created a clustered index and a nonclustered index that should be the same thing. However,...
1
vote
1answer
23 views

Powershell Invoke-Sqlcmd Replacing £ with?

When I create a SQL Script that inserts the value '£' or '€' into a table the value on the table is a question mark (?) Though, when I insert '$' it inserts a dollar sign. Anyone know what is going ...
-2
votes
1answer
45 views

SUBSTRING is not working in where condition in sql server [closed]

I have one written one query as per below. Its not giving result when i did sub- string. Declare @Result varchar(max) set @Result=(select top 1 value from empkeyValue) select * from department d ...
2
votes
1answer
34 views

Accurately simulate SQL Server work load with diskspd

We were building a new node in an alwayson availibility group and this new server was on a different storage than the other nodes in the cluster. Since it was a separate storage we wanted to make ...
0
votes
2answers
27 views

ssms does not let me change to server authentication mode and I can not log in

I have been using SSMS and logging in through server authentication for a week now and yesterday when I tried to login it suddenly told me "no process on the other end of the pipe". I researched ...
6
votes
2answers
860 views

On SQL Server, is it possible to restrict certain users from using certain functions, operators or statements?

we support a large number of developers and analysts who either do not know much or don't care at all about query performance. We have every day hundreds of poorly conceived queries (also due to ...
0
votes
0answers
24 views

Authintcation error 28000 + 18456

I have been trying to link my mssql database to Django. When I run the Django server I get the error below. For normal query (out of Django), it works fine, however, the Django doesnt even connect. ...
1
vote
1answer
15 views

update json value to null

As I understand it, if you select json_value or json_query specifying a key or object that does not exist in your json document, then in strict mode, you will receive an error. This allows you, for ...
0
votes
2answers
51 views

How to get results in separate rows after joining two tables

I have two tables say - Plans and Discounts. Below are the sample data in Plans table. Below are the sample data in the Discounts table. These two tables are related using PlanName column. I am ...
0
votes
1answer
12 views

Are Snapshot files created during MS SQL replication one time use only?

I added a new article in an existing publication. I saw that it generated a new snapshot folder (E:\Database\Snapshots\unc\S749TCAPDB01_NFS_XXXX_XXXX_PUBLICATION\20190417114556). But this folder ...
0
votes
1answer
25 views

Monthly Date Dimension

I am doing my first ssis and sql project for uni being new to both. I am creating a date dimension but only month and year no days. I have seen loads of examples online for date dim but including days....
5
votes
1answer
97 views

Okay to merge included columns on otherwise identical indexes?

I have two indexes that index the same field on the same table. The only difference between them is the included columns. There's no reason I shouldn't combine the included columns and just have one ...
4
votes
3answers
67 views

Is there a problem creating only differential backups every hour?

I have three databases which are not big. Every differential backup is roughly 50MB, then we have a full backup at midnight. Is there any problem doing this? I could take the full backup then logs, ...
2
votes
2answers
38 views

Selecting the same column from Different rows Based on Different Criteria

My table creates a row for each customer name for the unique customer number. CREATE TABLE #src(Number int, name varchar(32), seq bit); INSERT #src(Number,name,seq) VALUES (12345,'Mickey Mouse',0), (...
-1
votes
0answers
29 views

System Maintenance job getting failed at reindexing step [closed]

i am trying to find reason why system maintenance is failing at re-indexing step. anyone knows proper reason of failing job .please let me know . See the msg :The package execution failed. The step ...
1
vote
1answer
41 views

Equivalence of correlated DATEADD intervals

Is there any difference between the following statements? SELECT DATEADD(MONTH, @SomeInteger * 12, @SomeDate) SELECT DATEADD(YEAR, @SomeInteger, @SomeDate) In other words, are there any cases in ...
1
vote
0answers
54 views

Deadlock on two update statements on the same page

I'm receiving multiple deadlocks in one SQL Server. The deadlocks occur when the same query with different parameter values is being issued on the same database: Example: Query 1: UPDATE Tabel1 ...
0
votes
1answer
46 views

Drop the user from Read only Secondary database Always ON server

How to drop a user from the secondary database in an AG when it is in read only mode and synchronizing in SQL Server 2012? The login and user have been deleted from the primary database, and we are ...
0
votes
2answers
31 views

Database not going into single_user mode

I have a corrupt database with wrong checksum error. When I try to put database into single_user mode to repair it gives following error. I am using following sql command from management studio to put ...
6
votes
1answer
553 views

Why am I getting the error “non-boolean type specified in a context where a condition is expected” for this request?

I am getting this error : "Error 102 : non-boolean type specified in a context where a condition is expected" for this request : DECLARE @num_dossiers TABLE (num_dossier INT,indice NVARCHAR(3)) ...
2
votes
1answer
57 views

SQL binaries on C drive?

We are setting up a new SQL Server with over 2 TB size of Database, and this is a heavy OLTP. Let me know, if there is any impact of placing SQL binaries in C drive? or i would need another Drive? ...
0
votes
0answers
47 views

Why can't SQL Server handle into's in 2 parts of a script? [duplicate]

I noticed some behavior I found weird while editing a co-workers stored procedure: create procedure weird_behavior (@switch bit) as if (@switch = 0) begin select * ...
2
votes
3answers
84 views

Is there a way to retrieve the logical filename from a backup file?

I would like to write an automation script that restores a SQL Server DB from its backup file. However, doing this is not a straightforward procedure in SQL because the main query needs additional ...
0
votes
0answers
21 views

document creation for sql server tables [closed]

Hi How can i write documentation for end user(User friendly) Based on the views from the database.Which columns we are taking from which tables Document this information in a document with a user-...
1
vote
1answer
21 views

Would SQL Server Profile show triggers or other code which run as a side-effect of the query I'm profiling?

I've been using profiler to test a massive script I'm running in order to check for unintended side effects, e.g. triggers that I don't know about running because I've updated data in a certain table. ...
-2
votes
0answers
21 views

Convert Unix Time into Last 2 Weeks Data [closed]

I'm very new to SQL, but I'm trying to run an existing SQL query, but with only the last 2 weeks of data, where as the existing Dataset pulls the data regardless of when it was created. Our ...
1
vote
1answer
26 views

How to remove duplicates values within particular ID

Im struggling with removing duplicate values within certain employee ID. Here is the situation: ID || VALUE1 || VALUE2 || DATE 11 || Position1 || Other1 || 2019-04-04 11 || Position2 || ...
1
vote
1answer
17 views

SQL Services Wont Start After Removing TLS [duplicate]

I need to remove TLS 1.0 from one of my SQL servers. When I do so and then reboot the server the SQL services dont start automatically. When I attempt to start them I get an error that it cant be done....
0
votes
0answers
27 views

Create SQL Server Agent job for stored procedure with input parameter

Could you suggest please how to create SQL Server Agent job for a stored procedure that have 1 input parameter? The procedure is correctly created and i executed it using this code : EXECUTE dbo....
4
votes
1answer
794 views

How do database operations (write, update, alter) on particular cell in a table are written to disk without overwriting entire file?

When I want to write to or alter particular cell of an excel file/table using python I'll use pandas read_csv then alter value in particular cell and write back to file with to_csv. But writing back ...
1
vote
1answer
46 views

SQL Server - Queries are much faster on the application when run second time

When I click on a screen on my vb application, it takes approx 6/7 seconds to display the results. When I click off the screen and click back again into the screen, it returns immediately. I ran ...
0
votes
1answer
31 views

Orphaned users with their respective database name [duplicate]

I need to get a list of the orphaned users in each DB, together with the database name in which they are found in. I did the below which gives the orphaned users in each DB, but I cannot figure out ...
2
votes
1answer
82 views

An error occurred on the always on dashboard

I have a setup of Windows Server Failover Cluster and i am using SQL Server Service with one DC, One Primary Server and One Secondary Server. During Using SQL Server Management Studio, when i click ...
0
votes
0answers
5 views

WebSync Replication over HTTPS URL between SQL Servers on Cloud and on Intranet behind Proxy

I have a SQL Server instance running on company intranet behind a web proxy server. On cloud, I have an other SQL Server instance. I tried to implement WebSync method using replication between these ...
0
votes
2answers
52 views

Triggers vs. Jobs in SQL Server

I’m designing a database with a table that automatically gets loaded with a new record every 15 seconds (each record will have a 'timestamp' field and around 50 ‘float’ fields). Each record in this ...
1
vote
2answers
30 views

Can I avoid this cursor?

Let's say I have two tables in a banking application and table names are all_transactions and helpline_requests. The 'all_transactions' table keeps track of all kinds of transactions including ...
0
votes
0answers
17 views

Update password across all SSRS reports within a folder in Reporting services 2016

I am going through a manual intervention of manually updating the password in data source section for all the reports in SSRS2016. This is very tedious as i need to update this across 40+reports ...
-1
votes
0answers
19 views

Compare 500 files and load only distinct record

I have 400 to 600 different files and with same data type. But in these files, we have so many duplicates record in all the files. In my folder, there are A.txt, b,txt, c.txt files are there. It ...
0
votes
0answers
21 views

Is there anyway to make my sql server collect repositories from GitHub? [closed]

Hi Is there any way for me to make my database check for repositories in GitHub and add them to the SQL server? So if I add a repository in my account like 'CODEX' it would push the name and other ...
2
votes
1answer
70 views

Intermittent Login Issues with Windows Authentication

I have a strange one. I've been experiencing occasional login errors via windows authentication for the past couple weeks and the network team and I have yet to find a solution. I am running SQL 2016 ...
1
vote
1answer
79 views

How can I calculate future interest charges and loan balance

I have a table like below: Need to calculate interest for next month 100*(4.29/100). Row+1:Capital_Balance = Row:Capital_Balance_Calculated - Calculated interest from above step. Resultant table is ...
0
votes
1answer
52 views

SQL Server Authentication

I am able to access a database using the Windows Authentication method in DBeaver. However, when I switch to different account in Windows and I would like to access the datebase, I used SQL Server ...
5
votes
1answer
113 views

Can we download SSRS 2017 to use with SQL Server 2016?

We are using our organization's SQL Server 2014 SP3 servers. (They also have 2016 SQL Servers, but we elected to skip 2016 and just move to the next SQL servers when they get installed.) We have a ...
6
votes
1answer
82 views

Understanding Plan Choice When Query Store Doesn't Respect Forced Plan

I'm trying to figure out a situation that I encountered last week where, in an attempt to temporarily fix a plan regression during an incident, I forced an execution plan using Query Store, but found ...
-1
votes
1answer
79 views

Sniff MSSQL Connection String

Let's say, there is an .NET application on a windows 7 host where I have administrator's access rights. The application works with remote MS-SQL server on port 1433 which I don't control. I want to ...
2
votes
1answer
91 views

Memory Optimized table: Index size 10X bigger than data

On one of our production servers, I found out that Index size is 10X times bigger than data size. These servers and schemas are identical with a similar workload. CREATE TABLE [dbo].[...
0
votes
1answer
36 views

Calculating count on same table based on condition

So I need to calculate the amount of Clients who's LastName start with the same letter, then use that count as part of an Reference number. I.e. something like this: declare @...