Here's a few of the new posts today on the forums. To see more, visit the forums. |
SQL Server 2017 - Administration |
Cumulative Updates - I am about 6 versions behind on my cumulative updates, and need to apply the latest one. I have looked for detailed documentation but haven't found any yet. I have a DEV environment and a test environment that I can apply it to first, however, these environments will not have the workload of the production […] |
SQL Server 2017 - Development |
Substract 2 values - Hello, I would like to minus from rows. 'Other Cost' minus the rest of the rows. select 1 Period,'Main' Category,100 Value union all select 1 Period,'Cost' Category,5 Value union all select 1 Period,'OtherCost' Category,20000 Value I tried like this but is not working. Can someone guide me. select Period,Category , SUM(CASE WHEN Category='Main' THEN [Value] […] |
pagination with case - Have a requirement of case , pagination in Order by clause. It looks something like this. But getting error. how to fix ORDER BY case when (@PageCount <= 0 OR @PageIndex <= 0) then c.fullname else ( c.fullname OFFSET (@PageCount * (@PageIndex - 1)) ROWS FETCH NEXT @PageCount ROWS ONLY ) end |
SQL Server 2016 - Administration |
Statistics Update Frequency - What's the best way to know which index statistics need to be updated on a daily basis? I currently update stats on Friday, but I've noticed SQL is updating some of my stats automatically. The issue is the auto update of stats doesn't do a full scan, so it causes slowness and bad query plans. […] |
SQL Server 2016 - Development and T-SQL |
Counting Instances in TEXT - Hello Community, I have been presented with the following SQL challenge Find the number of times the words 'bull' and 'bear' occur in the contents. We're counting the number of times the words occur so words like 'bullish' should not be included in our count. Output the word 'bull' and 'bear' along with the corresponding […] |
Copy tables from one db to another db - I have a user that needs to truncate a number of tables in DB2 and then make a backup of some tables from DB1 before a lengthy import process begins. What I would like to do is have the user call an SP that truncates the destination tables in DB2 and then copies the data […] |
Administration - SQL Server 2014 |
Space Error - Hi Experts, I got error on one of our production database. Could not allocate space for object 'dbo.'.'' in database '' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup. […] |
Development - SQL Server 2014 |
Is this a RBAR? - DECLARE @forms TABLE ([Id] int NOT NULL); INSERT INTO @forms ([Id]) VALUES (2481916), (2481917), (2481918), (2481919), (2481920), (2481921), (2481922), (2481923), (2482093), (2482094), (2482095), (2482096), (2482097), (2482098), (2482099), (2482100) DECLARE @versions TABLE ([FormVersion] int NOT NULL, [FormId] int NOT NULL, [CreatedDateTime] datetime); INSERT INTO @versions ([FormVersion], [FormId], [CreatedDateTime]) VALUES (1, 2481916, '2021-01-01'), (2, 2481916, '2021-01-02'), (1, […] |
SQL 2012 - General |
how to do the following operation while the tables under different schema? - how to do the following operation while the tables under different schema? for example, there are two tables with same name but under different schema in the same database, one table saletable under schema A and the other table saletable under schema B, how to do this operation , such as sp_helpindex , sp_spaceused and […] |
SQL Server 2019 - Administration |
"execute as login" limited to the query window? - Hi! Let's assume I'm doing "execute as login='user1' " and that user 1 only has access to northwind_spp database. If I try to run something under it such as "select * from adventureworks2019" it will give an error that this user1 does not have access to that database. However, if I go to the left […] |
How to Export Yahoo mail to Gmail - I want to export my emails from Yahoo Mail to Gmail account. |
TDE + Encryption key in Azure Key Vault - Hi all, I have SQL 2019 server with Always On of a few servers. I am using TDE on the DBs with encryption key managed by Azure Key Vault (AKV). From time to time, as every Azure managed service, the AKV is not available for different time periods which causes us to have the DB […] |
SQL Server 2019 - Development |
Only lists records when StockValue changes - Good day, After running below create and insert scripts, my query should only return the rows in blue color (when StockValue changes from IN to SOLD , SOLD to IN, IN to SOLD) I've listed 2 NR's to help with understanding what I'm looking for. Can anyone help me with this? Thank you |
SSIS SQL Agent Job - SQL Step referring other server - Hi there, everyone. I have a bit of a pickle. I need to move all our SSIS jobs from one server to another. The problem is all the databases that are used / queried also reside on the same server. One of the jobs has a step that runs a SQL query inside that actual […] |
Amazon AWS and other cloud vendors |
use SCT to synchronize schema - Hello , I did a SQL database migration to RDS AWS DMS there were missing objects (index, foreign key, founction) Can I use SCT AWS Schema Conversion to add these objects? thanks |