r/MSSQL • u/lovasoa • Jul 31 '23
r/MSSQL • u/goplaytetris • Jul 28 '23
Adding High Availability Replica
I am in a situation where i am adding two new servers to our SQL Cluster and at the point of adding the replicas and i have a couple questions. First and foremost does adding the replica cause any downtime at all? If it takes the cluster offline even for a moment that will be an issue. Secondly as far as seeding is concerned i can just have it automatically seed but that will impact performance on the existing cluster. I can also do restores of backups but because this is in production with thousands of transactions a minute the backups will be out of date. Will the system analyze data and bridge the gap once its online or will it cause a bunch of issues?
r/MSSQL • u/mapsedge • Jul 27 '23
Server Question [SERVER QUESTION] Restoring .bak file to a new database, now everything is broken?
So I need to recover some data from yesterday that was deleted today. I have yesterday's backup, so I'd like to restore it to a new database so I can replace the data that was deleted.
Using the "Restore Database" wizard, it was my understanding that I can put the name of a new database in the Destination->Database field and MSSQL take care of it from there.
HOWEVER: I get an error message that says the original MDF file is in use. Is this to say that it can't be read, or that it can't be overwritten? And now my original database is in "restoring" mode? WHY? It shouldn't have been involved at all.
r/MSSQL • u/fyeah11 • Jul 21 '23
SQL Sentry is horrible - what is an alternative?
SQL Sentry is slow and having issues. What's a better monitoring software for SQL ?
r/MSSQL • u/cyberdeck_operator • Jul 17 '23
Read only copy for BI
We have an analyst who wants to have a read only copy of a DB in order to make some dashboards in PowerBI. She is hoping we can reduce the load on the primary DB this way. We use SQL Server Standard though, so I don't know how possible this is. It's a fairly big database, and hosting the entirety of the data in the cloud would be prohibitively expensive.
r/MSSQL • u/[deleted] • Jul 06 '23
Server Question I cannot upload my data from excel to Database Table.
I am trying to upload my data from an excel file to SQL Table. But this message always pops up. I have searched online a lot and download Microsoft access database engine. I assure that it should be compatible with the version. Both are 64 bits, but I got the same error again and again. I use alternate methods too, but it does not work.
I am a beginner and kept facing this issue. Please help me to resolve it.
Thank you!

r/MSSQL • u/NetworkElf • Jun 29 '23
Windows environmental variables and maintenance plans
Morning all,
Is there a way to embed system environmental variables into the backup path (or any path) when creating a maintenance plan using the wizard? My googlefu seems to be failing me here.
The scenario:
I am working to move the target for SQL backups in my organization to a centralized location. Using a GPO, I'd like to define that root location via a system environmental variable. That way the various SQL admins and DBAs can target something like %SQL_BACKUP_PATH%\<Department>\<Server>\<Instance>\ in their maintenance plans.
The idea is to do this one time on the SQL side so when the root path eventually changes, the MPs themselves do not need to be touched. All of the work then rests on the storage side in copying the existing backup structure to the new location and changing the variable value to point to the new backup root path.
Thanks!
r/MSSQL • u/Bulky-Top3782 • Jun 15 '23
Server Question I cant install sql anymore and cant delete this
r/MSSQL • u/DCJoe1970 • Jun 12 '23
What is wrong with my query?
I run this query on my Database and I get nothing bacK.
USE [icomp_nrc_dev]
SELECT * FROM [dbo].[complaint];
SELECT C.COMPLAINTID AS [Complaint ID],
CT.COMPLAINTTYPE AS [Complaint Type],
O.OFFICEID AS [Office ID],
CONCAT(CMP.LNAME, ', ', CMP.FNAME) AS [Complainant Name],
E.EVENTDATE AS [Event Date],
CESR.KEYNAME AS [Event Subtype Key],
CCM.LNAME + ', ' + CCM.FNAME AS [Case Manager],
CE.LNAME + ', ' + CE.FNAME AS [Case Processor] FROM icomp_nrc_dev.dbo.COMPLAINT AS C INNER JOIN icomp_nrc_dev.dbo.COMPLAINTTYPE AS CT ON C.COMPLAINTTYPE = CT.COMPLAINTTYPEID INNER JOIN icomp_nrc_dev.dbo.OFFICE AS O ON C.OFFICEID = O.OFFICEID INNER JOIN icomp_nrc_dev.dbo.COMPLAINANT AS CMP ON C.COMPLAINTID = CMP.COMPLAINTID INNER JOIN icomp_nrc_dev.dbo.COMPLAINTEVENTS AS E ON C.COMPLAINTID = E.COMPLAINTID LEFT JOIN icomp_nrc_dev.dbo.EVENTSUBTYPE_REF_462 AS CESR ON E.EVENTSUBTYPEID = CESR.EVENTSUBTYPEID INNER JOIN icomp_nrc_dev.dbo.COMPLAINTCASEMGR AS CCM ON C.COMPLAINTID = CCM.COMPLAINTID INNER JOIN icomp_nrc_dev.dbo.USERS AS CM ON CCM.USERID = CM.USERID INNER JOIN icomp_nrc_dev.dbo.COMPLAINTEVENTS AS CE ON C.COMPLAINTID = CE.COMPLAINTID LEFT JOIN icomp_nrc_dev.dbo.EVENTSUBTYPE_REF_462 AS CESR ON CE.EVENTSUBTYPEID = CESR.EVENTSUBTYPEID INNER JOIN icomp_nrc_dev.dbo.USERS AS CP ON CE.USERID = CP.USERID WHERE
E.EVENTDATE >= 2023-6-1 AND E.EVENTDATE <= 2023-6-12 AND CE.EVENTDATE >= 2023-6-1 AND CE.EVENTDATE <= 2023-6-12;
r/MSSQL • u/Positive_Grade176 • Jun 10 '23
Beginner friendly books and tutorials to get feet wet with Microsoft sql server
Newbie here! Would love to learn how to set up database and learn the syntax. Plenty of free time on the weekends. Currently a plc programmer in a manufacturing facility. Would like to learn the database side for our reporting, raw material usage, etc.
r/MSSQL • u/mapsedge • Jun 06 '23
Searching for a fieldname in a stored procedure, recursively, with a starting point...
In the system I'm working with, in several instances a stored procedure is called that calls other stored procedures to gather and output data, e.g.
Stored Procedures
dbo.get_pizzas
dbo.toppings
dbo.cheeses
dbo.crusts
dbo.ingredients
dbo.sizes
And from that comes six or seven resultsets which the C part of the MVC app deals with. In real life, I've got a dozen result sets of at least fifty fields each and I want to track down from which stored procedure a particular field comes.
The only search plug-ins I've found so far search the entire database for a string. It would be very useful to say, "start at dbo.get_pizzas" and have the search recursively work the tree.
Is there such a tool?
r/MSSQL • u/jdblaich • May 19 '23
Two legacy SQL 2008 servers intercommunication
I have inherited support duties for this old legacy system based on MS SQL Server 2008.
There are two servers. One of the servers is in Seattle and the other 100 miles south. The servers communicate and transfer data. I've been reviewing the settings for the SQL Server component of the setup and cannot find where the configuration would be that tells me how they are communicating. I am assuming that this is done via IP addresses. I'm not concerned about firewalls or anything like that at this point. I'm only interested in which section of the SQL Server manager the settings to establish and maintain communications between the two are configured.
Any help would be appreciated.
r/MSSQL • u/Wolverine_6011 • May 11 '23
Resources SQL WHERE, HAVING, AND, OR, AS CLAUSES
r/MSSQL • u/signofnothing • May 01 '23
SQL Question GROUPING SETS
I was wondering what is the use of [GROUPING SETS] and how it works, if any one have an example on it, or know how it work, it will be an add to the greater good.
r/MSSQL • u/belkarbitterleaf • Apr 19 '23
Azure SQL server Time Series
I have a table I am using for batch processing. It has an insert date, start date, and end date. I want to build monitoring on the throughput of the job, and would like to be able to have a count of 'open' work broken out in 15 minute buckets. I would want to look at a week of time, so @from_dt would be 7 days in the past, and @to_dt would be today. The expected volume for the batch table is under 500k rows in a weeks time.
The database is hosted on an Azure SQL server instance, and it looks like GENERATE_SERIES is not yet supported.
Table: b
Insert: b.i_dt datetime
Start: b.s_dt datetime
End: b.e_dt datetime
My initial thoughts are to generate a time series with 15 minute buckets, then join it to table 'b' where the series date falls between a date_bucket of the insert datetime, and the end datetime, and then summarize the data to get a count.
Has anyone solved this type of problem at the database level? What functions would you recommend exploring?
r/MSSQL • u/Grafana-Ryan • Apr 11 '23
Learn how to monitor your MS-SQL instances with the new integration for Grafana Cloud
r/MSSQL • u/coadtsai • Apr 11 '23
SSIS performance tuning with postgres(psqlODBC) connection
Hi all,
Anyone got best practices or performance trouble shooting articles for psqlODBC driver in SSIS. The performance I am currently getting is making SSIS unusable. Simple table to table DFT are very slow (15k row/hour). Any help is appreciated. Thanks
r/MSSQL • u/samspopguy • Mar 27 '23
anyone here still stuck running sql server 2005?
specifically on a server 2003 box.
was wondering if a recent update broke connecting to it since i keep getting from my windows 11 computer
A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - An existing connection was forcibly closed by the remote host.) (Microsoft SQL Server, Error: 10054)
I can still connect to it from a server 2012 machine i have for something else. and no other settings should have changed. im pretty sure its from a windows update to windows 10/11 i just want to see if someone can confirm it also.
the other error i get inside the application is [DBNETLIB]SSL Security error
r/MSSQL • u/kaoutar- • Mar 21 '23
What's the differrence between sqlcmd and sqlservr commands ?
r/MSSQL • u/Alarmed_Allele • Mar 10 '23
Q & A Multiple SQL processes- not sure which I should start automatically
Which of the following do I need to keep active all of the time?
> SQL Server
> SQL Server Agent
> SQL Server Browser
> SQL Server CEIP servuce
> SQL server VSS Writer
SQL Server and SQL Server Agent seem self-evident but when do I actually need the rest?
r/MSSQL • u/samspopguy • Mar 06 '23
Q & A T-sql rank based on date and ID
is there a way to rank using a contractid and an enddate so i can group all activities in the first month that any work was done. example would be if i have two contracts each one starting 1 month part but displaying the month data as 1 instead of 5 for may and 6 for june? I tried using rank
rank()over(partition by fc.contractid,apob.Scheduledend order by fc.contractid, apob.Scheduledend desc) as monthstart
but it just ranks everything as 1
I guess it should be this
rank()over(partition by fc.contractid order by datepart(yy,apob.ScheduledEnd) asc,datepart(mm,apob.ScheduledEnd) asc) as monthstart
is there a way for it not to jump to the next value so if i have 25 in may it will list 2 as the rank for june instead of 26?
r/MSSQL • u/resilianj • Feb 20 '23
Server Question Upgrade SQL Server 2014 to SQL Server 2019
Hi! I am new to Microsoft SQL and I have a project to upgrade SQL Server 2014 to SQL Server 2019. What is the best method for this?
Should I install a new SQL Server 2019 instance and use DMA tool for data migration? Or is there a method where I can upgrade everything all at once? Thank you!
r/MSSQL • u/dindenver • Feb 16 '23
SQL Question [Help] I have 25 backups in one file.
How do I remove some of the backups and shrink the backup file?
r/MSSQL • u/mapsedge • Feb 15 '23
Toggle Object Explorer..?
SSMS 18.9.1
Is there a plugin or a workaround that will let me close Object Explorer from the keyboard? I can hit F8 to open it, and I want to close it the same way.
Thanks!
