|
|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
Attaching Databases | |
With SQL Server 2022, what is the recommended code to attach a database? | |
Think you know the answer? Click here, and find out if you are right. |
Yesterday's Question of the Day (by Steve Jones - SSC Editor) |
Backing Up Master Can I run this in SQL Server 2022? ALTER DATABASE master SET RECOVERY Full If yes, can I then run this? BACKUP DATABASE master TO DISK = 'master_20231121_1045.bak' go CREATE LOGIN TestDev WITH PASSWORD = 'DemoUserP@ssw0rd' GO BACKUP LOG master TO DISK = 'master_20231121_1045.trn' GO Answer: Yes and No, I don't know Explanation: You can run the first code, and the master database will show a recovery model of Full. However, when you try to run the second line, you get this error: Msg 4212, Level 16, State 1, Line 11 Cannot back up the log of the master database. Use BACKUP DATABASE instead. Msg 3013, Level 16, State 1, Line 11 BACKUP LOG is terminating abnormally. Therefore, the correct answers are yes, you can change the recovery model, and then no, you cannot run a log backup. Ref: Backup and restore: system databases - https://learn.microsoft.com/en-us/sql/relational-databases/backup-restore/back-up-and-restore-of-system-databases-sql-server?view=sql-server-ver16 |
Database Pros Who Need Your Help |
Here's a few of the new posts today on the forums. To see more, visit the forums. |
SQL Server 2016 - Development and T-SQL |
STUFF Command Not Working - I am trying to use the STUFF command, however, the column using the STUFF just seems to just include everything, instead of the ones specific to the user. I am hoping someone can notice what I am doing incorrectly in my SQL Statement. Below is the code I am using. SELECT DISTINCT G.[Period], G.[Sector], G.RID, […] |
WHY Follow a LEFT OUTER JOIN with another LEFT OUTER JOIN - NOTE: The Topic Title probably isn't very good but I wasn't sure how to title this with a limited amount of text. I thought I had previously asked about this but according to my history I haven't. I have run across some code that I've never dealt with before and I'm curious if you guys […] |
Development - SQL Server 2014 |
Not enough disk space error - Hi, I keep getting this error message saying that I don't have enough disk space whenever I run a query. based on suggestions online I tried freeing up some disk space by cleaning up temporary files. This however is a temporary fix I noticed that my C drive quickly goes from, say, 9 […] |
SQL Server 2019 - Administration |
Drop or delete a existing partition - Hello, so I was reading on partitioning a large table, Which i successfully did, using the clustered index and partition function/schema... example the table is a simple table with 4 columns CREATE TABLE Orders ( OrderID INT PRIMARY KEY, CustomerID INT, ItemID INT, OrderDate DATETIME ); CREATE CLUSTERED INDEX Order_Date_Added_Partition ON dbo.Orders (OrderID) WITH […] |
Compare all tables row counts for 2 server instances? - USE [DBName] SELECT QUOTENAME(SCHEMA_NAME(sOBJ.schema_id)) + '.' + QUOTENAME(sOBJ.name) AS [TableName] , SUM(sPTN.Rows) AS [RowCount] FROM sys.objects AS sOBJ INNER JOIN sys.partitions AS sPTN ON sOBJ.object_id = sPTN.object_id WHERE sOBJ.type = 'U' AND sOBJ.is_ms_shipped = 0x0 AND index_id < 2 -- 0:Heap, 1:Clustered GROUP BY sOBJ.schema_id , sOBJ.name ORDER BY [TableName] I have the code above […] |
Ola hallengren backup not deleting old backup files for SQL 2016 Clusters - Ola hallengren stopped deleting older files for SQL Server 2016 which are on cluster. Files can be deleted manually but not with SQL script which had been working. |
Replication Monitoring with Always On Availability Group - Hey Folks, So I have SQL Transactional Replication set up on a database that's part of an AOAG. Everything is working fine except for one thing. After a failover, the Replication Monitor is not able to show any info since the primary is where the replication was configured and now the secondary is the new […] |
SQL AOAG with listener ( without windows clustering) - Hello, I am deploying SQL 2019 Enterprise edition with AOAG ( without windows clustering). Steps done : 1. SQL installation done on 2 nodes 2. Service account is added as sysadmin on both servers 3. Enabled AOAG on both nodes 4. Database created & backup taken 5. Configuration of AG is done. Database added. Listener […] |
SQL Server 2019 - Development |
converting date - cast(DATEADD(DAY, case when j1 is null then 0 else j1 end, j_date) as date) as 'DateEnd', I get results as 12/1/2023 12:00:00 AM when data gets imported to my txt file, what can be done to remove time, I need result: 12/1/2023 Thank you |
Powershell, how to convert file to txt pipe - Hello, how can I change this code to txt pipe format? $DataSet.Tables[0] | Export-csv -Path "C:\Test.txt" -NoTypeInformation |
SQL Azure - Administration |
SQL Replication - Disconnected from Azure Storage with OS result code: 0 - Hello, We had a few errors with replication for SQL Managed Instance stopped working with "Disconnected from Azure Storage "\\StorageLocation" with OS result code: 0. Can restart it again with no issues but not sure why it has happened now a few times. Any suggestions on how to troubleshoot? Thanks, Daniel |
Reporting Services |
Summing different fields on a group by - HI I have a data set with student info; Name, Type there would be multiple lines for each student Soemthing like StudentA, Type1 StudentA, Type2 StudentB, Type1 StudentC, Type2 I want a matrix where its grouped by student then have two columns, Type1, Type2 Output to be: STudent Type1 Type2 StudentA […] |
Powershell |
Create a new SQL DB then copy tables and data from MS Access DB - Hi, I'm looking for some advice and to find out if the following is possible. I have an Access DB that get's updated each week, In order to improve our reporting, I'd like to create a new SQL DB each week, with a copy of the Access DB tables and it's data. I want to […] |
PostgreSQL |
PostgreSQL authenticated against Microsoft Active Directory - Can I authenticate with Active Directory and get into PostgreSQL? Version: PostgreSQL 16.1 on Windows Server 2022. I'm running DBeaver Community (portable version) on Windows 11 and successfully connect using database user postgres. I found this doc that suggests using GSSAPI to authenticate against Microsoft Active Directory. Confused now if I should be using LDAP […] |
SQL Server 2022 - Administration |
Provider not found in SSMS - I am trying to setup a linked server and per the documentation it needs to use MSODBCSQL18 - and so we've installed that. It's installed because if I go into the ODBC Data Sources in Windows, I can see it under Drivers and create a connection with it there. However, in SSMS I still only […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |