Here's a few of the new posts today on the forums. To see more, visit the forums. |
SQL Server 2017 - Development |
Simple GROUP BY Query - Hello: I have this query. I am trying to understand why I have to GROUP by all of the fields in my SELECT Statement. Also, the query is returning the sum for all of the jmoJobID fields, when I want this to be summed by the jmaPartID field. SELECT DISTINCT JobOperations.jmoJobID, JobAssemblies.jmaPartID, JobOperations.jmoWorkCenterID, JobOperations.jmoProcessID, JobOperations.jmoOperationQuantity, […] |
SQL Server 2016 - Administration |
AG Question - is it possible to make secondary database to read/write in secondary replica in always on . |
Development - SQL Server 2014 |
Count Null Records with Group BY - I've searched and tried many variations, but must be missing something simple. If there are no records, I'm trying to get RecordCount to display zero '0'. I don't get errors, just no results. What am I missing? Thanks! SELECT IsNull(Count(InvNo),0) AS RecordCount, BatchID FROM BatchOrders GROUP BY BatchID |
group parts by row count - hello I have a table similar to this: Create table parts ( partid int not null serial varchar(50) not null ) insert into parts(partid, serial) values(1,'31511') values(1,'961511') values(1,'61511') values(1,'77421') values(1,'74522') values(1,'329484') values(1,'1934891') values(1,'19348924') so what they want is to have it grouped by for ever 5, give it a group ID, and have […] |
SQL 2012 - General |
Query Issues - pageiolatch_sh wait high clustered index insert cost - Hi Accidental DBA here We have an application that runs a select * on a table upon starting the application. There are 2.4 million rows in the table. Today it was reporting a pageiolatch_sh wait and took 50 minutes to complete. During this time the application cannot be used until the query completes. Looking at […] |
Change Owner on AG Endpoints - A long-serving DBA is leaving us soon, and his account is the owner of various bits and pieces within one of our AGs. Not ideal, but one of those things from when the company originally set the system up, many years ago, and has never been addressed. We're quite happy with the code that we […] |
SQL Server 2019 - Administration |
There and back again: From a partition number to a filegroup and vice versa - I've been trying to navigate the DMVs concerning partitions and filegroups and find my way between them. I might have a partition number and want the filegroup name(s) (and ultimately the files in the group). Or, I might have a filegroup or filename and want the partition(s) that it holds. Here's my test case: USE master; DROP DATABASE IF EXISTS TestParts; CREATE DATABASE TestParts ALTER DATABASE TestParts ADD FILEGROUP FG1 ALTER DATABASE TestParts ADD FILEGROUP FG2 ALTER DATABASE TestParts ADD FILEGROUP FG3 ALTER DATABASE TestParts ADD FILE (NAME=File1, FILENAME = 'C:\temp\File1.ndf', SIZE = 1MB) TO FILEGROUP FG1 ALTER DATABASE TestParts ADD FILE (NAME=File2, FILENAME = 'C:\temp\File2.ndf', SIZE = 1MB) TO FILEGROUP FG2 ALTER DATABASE TestParts ADD FILE (NAME=File3, FILENAME = 'C:\temp\File3.ndf', SIZE = 1MB) TO FILEGROUP FG3 Now, create a partitioned table: USE TestParts […] |
SQL Server DWH on local Storage Spaces - Hi there, I am setting up a SQL Server 2019 EE with WS2019 with local storages spaces. I have tried out different layouts for the storage e.g. Storage Spaces - Virtual Disk with 2way mirror, Storage Spaces - Virtual Disk with 3way mirror. with my DWH tests on my specific hardware the version Storage Spaces […] |
Patching SQL Servers - Hi all. Just curious about SQL patching and SQL updates. Who does the patching in your environment? Networking teams or DBAs? What are the pros and cons of either. Thanks! Anita |
SQL Server 2019 - Development |
Loan Amortization Schedule for SQL Server - So, long story short... A conversation about loops, cursors and in-line functions ended up with me proclaiming that I could could do a full payment level, loan amortization schedule using only set based t-sql (famous last words). My attempt to cheat by finding something pre-rolled on Google fell flat and was forced to actually do […] |
Subquery returned more than 1 value. This is not permitted ! - Hello, I run the following query: SELECT RIS_OPT_SERV.CTC_DEPOT ,CONVERT(CHAR(4), B.DATE_DEPOT, 120) + '-' + CONVERT(CHAR(2), B.DATE_DEPOT, 101) DATE_DEPOT ,RIS_OPT_SERV.NO_CONTRAT_DEPOSANT ,RIS_OPT_SERV.NOM_DEPOSANT ,RIS_OPT_SERV.NO_CLIENT_DEPOSANT ,RIS_OPT_SERV.NUMERO_REF ,RIS_OPT_SERV.LB_PRODUIT_LONG ,RIS_OPT_SERV.LIB_OPTION_AFF ,RIS_OPT_SERV.NO_BORDEREAU ,RIS_OPT_SERV.LIB_SERVICE ,B.PRODUIT ,B.MECA ,B.PRESENTATION ,B.TRANCHE ,B.NB_PLIS ,B.POIDS ,B.TARIF FROM (SELECT RIS.NO_CONTRAT_DEPOSANT ,RIS.NOM_DEPOSANT ,RIS.NO_CLIENT_DEPOSANT ,RIS.CTC_DEPOT ,RIS.NUMERO_REF ,RIS.NO_BORDEREAU ,RP.LB_PRODUIT_LONG ,(SELECT RS.LIB_SERVICE FROM RESSOURCE_SERVICE RS WHERE RS.CLE_REF = RIS.CLE_REF AND RS.CODE_SERVICE in (SELECT […] |
Question on BCP - I have been looking everywhere, and cannot find anything on this . Can anyone tele me if you can used BCP and xp_cmdshell to insert data from one table to another? and if this can be done please let me know where I can get information on this. Thank you |
SQL Server 2008 Performance Tuning |
Same queries different client with different performance - I have 20 same client programs each installed in windows xp. Each client issues a specific query to sql server 2008 R2 in a database with compatibility level 80 (Sql Server 2000). The clients use ODBC. The performance suddenly dropped too much. except for one machine. and now I'm wondering why. I attach 2 trace […] |
Same queries different client - I have a Siebel CRM with Sql Server back-end database (Sql server 2008 R2 but the database has compatibility Level 80 (Windows 2000)). Each Siebel client is Windows XP with a front-end installation. The client pc has access to the back-end database through ODBC (Sql Server 2000). All of the clients suddenly slow down a […] |
Reporting Services 2005 Administration |
How can we let SQL Server 2005 X86 recognize and use RAM greater than 4GB - I have a windwos server 2003 R2(64bit) installed SQL Server 2005 X86 Standard Edition . I have enabled AWE(as screenshot), and restarted windows server, but when I ran SQL Server (even if I ran the complicated computation). system can't use the RAM greater than 4GB. because as some reason we can't upgrade SQL server from […] |