Loading...
|
|
|
|
|
|
|
Question of the Day |
Today's question (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 | |
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) |
A Partial Count I run this code in a SQL Server 2022 version of AdventureWorks: SELECT COUNT(*) FROM Sales.CustomerI get 19280 as the result. What happens when I run this? SELECT COUNT(*) FROM Sales.Customer TABLESAMPLE SYSTEM(10 PERCENT);Answer: I get results that range from the hundreds to over 3,000 Explanation: The TABLESAMPLE clause will cause SQL Server to return approximately the number of rows as a percentage of the table, but the actual number that comes back can vary dramatically. The reason is that this gets a sample of data pages, not rows, and since there can be varying numbers of rows on pages, you can get various results. In testing, I have seen results below 500 and over 3500. Ref: FROM - https://learn.microsoft.com/en-us/sql/t-sql/queries/from-transact-sql?view=sql-server-ver16#examples |
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 2017 - Administration |
Small Transactional Table with Frequent Updates - Hi All We have a 12 row on our platform that gets updated for every transaction and stores Identity values used by each transaction. Every time a new transaction is received, the appropriate transaction row is incremented by 1. The trouble we're seeing more and more lately is contention through that table during busy periods, […] |
SQL Server 2017 - Development |
Slicing status based on conditions - Hi, I have a table ShipperStatusHistory that tracks orders, Shipping status and relay points (for customers where to collect packages) . I want to flag the package That weren't collected by customers for each a relay point. To identify a left package (not collected by customer) the status need to be ("Dropoff" or "preparation") ***OR […] |
SQL Server 2016 - Administration |
broker error - Hello, I install a broker under sql server 2016 and I have a message that I never recognized. In transmission_status : "24(The program issued an incorrect length command.)" The message of 25490 characters long has not been sent. Thank you in advance for any help. |
Administration - SQL Server 2014 |
Suggestion on HA DR solution for transactional replication published database - Hi All, I am planning for HA DR solution for transactional replication published database. (Not for distribution DB). It is in SQL 2014 standard edition and having 4 subscriber for only one database, I am planning to have either log shipping or DB mirroring into another server. Can anyone suggest which is best to for […] |
SQL Server 2019 - Administration |
Sporadic error during restore job - Hello experts, I see this error in a SQL Agent job. It happens during a step that restores a database, and it is supposed to temporarily enabled xp_cmdshell to read some backup files, then disable xp_cmdshell. Does anyone know why this error happens, and why it happens only sometimes? Thanks for any help. Configuration option […] |
SQL Server 2019 - Development |
Migrating DB to new DB schema - Hello everyone, I am rather new to SQL-Server and got a problem to which I cannot find a solution. But first to my project. I am developing a software with C# ef core and SQL-Server with the code first approach. Bothe get hosted by me via docker containers. My current problem is that I want […] |
AI Tools - Not quite sure where to post this or how quite to ask as its early stage I am looking for two type of AI tool A tool to go through data and check accuracy/ confidence levels very simple example( millions of records ) a customer table with Company name , addresses, postcodes etc a separete […] |
Openrowset & removing unwanted characters... - Folks I'm wondering can you help me here. I have inherited a system that populates a table from Excel using the OPENROWSET command. The table in question is called: tbl_raw_data and then the loaded data is moved on elsewhere... The excel speasheet can and does change column names and number of rows over time. The […] |
SQL Server 2008 - General |
Reduction of installation time of sql server 2008 R2 Express - The installation of SQL Server 2008 R2 Express on a virtual machine takes around 12-15 minutes, whereas on a regular PC, it takes around 5-6 minutes. Are there any options to reduce the installation time ? The following approaches have been attempted: Via command line: SQLEXPR_x64_ENU /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS /QS /FEATURES=SQLENGINE /INSTANCENAME=PMP /SQLSVCACCOUNT="NT AUTHORITY\SYSTEM" /AddCurrentUserAsSQLAdmin /SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS" […] |
Strategies and Ideas |
data security for a data warehouse - I'm working with someone whose client says "Yes, we have a data warehouse. But NO you can't be granted access to it." Technically, can you not create one or more schemas and add views to the schema ( and the other necessary required objects ) so that the outsiders are granted some but not full […] |
Integration Services |
PowerQuery in SSIS... is it only in 2023? - First off, I'm terrible at SSIS... I'm trying to create a PowerQuery data source, and it's flat out not there in VS 2022 (yes, I have the rest of SSIS installed). is it only in 2023? is there a good rank beginner article on getting started with it somewhere? I saw one, but I wanted […] |
General |
Review of DB Activity - Hi Folks, I have been tasked with reviewing all the activity on a SQL Server 2000 - Version 8.00.2666 (SP4) I have monitored DB's before and via execution of Master DB stored procs, watching activity and so on, however never really when in to this depth of attempting to find out all the activity […] |
SQL Server 2022 - Development |
Average price calculation - Hello! I need to make a query that will calculate my average price for each item. CREATE TABLE [dbo].[Table_1]( [id] [int] IDENTITY(1,1) NOT NULL, [idProduct] [int] NOT NULL, [Product] [nvarchar](50) NOT NULL, [Quantity] [decimal](18, 2) NOT NULL, [Price] [decimal](18, 2) NOT NULL, CONSTRAINT [PK_Table_1] PRIMARY KEY CLUSTERED ( [id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE […] |
Need help on query - DATEDIFF - Hello, I want to have value Month ago Year ago So far, I've this SELECT CASE WHEN DATEDIFF(SECOND, crtDte, GETDATE()) < 60 THEN ' Just Posted' WHEN DATEDIFF(MINUTE, crtDte, GETDATE()) < 60 THEN CAST(DATEDIFF(MINUTE, crtDte, GETDATE()) AS VARCHAR(10)) + ' Minutes' WHEN DATEDIFF(MINUTE, crtDte, GETDATE()) < 24 * 60 THEN CAST(FLOOR(DATEDIFF(MINUTE, crtDte, GETDATE())/60) AS VARCHAR(10)) […] |
sp_dropserver - Bug/behavior change - Leaves transaction open after TRY...CATCH - Verified on latest CU 10 for SQL 2022. Confirmed works correctly on SQL 2019 (i.e. no open transaction). When it cannot drop server because it is used in replication, the transaction count goes from 0 to 1 after the CATCH. This causes stored procedures with this code to fail, since the transaction count is unexpected. […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Loading...
Loading...