|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
Robust Plans | |
What does the ROBUST PLAN query hint do? | |
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) |
The Delete Order I create a table, dbo.car, with an identity column in it. I add 7 rows to this table with various inserts. I then want to execute this statement: DELETE TOP(1) FROM dbo.car Which row is deleted? Answer: Any single row could be deleted. Explanation: As with a SELECT, if there is no ordering or filtering, any row could be deleted by a TOP 1 statement. In this case, the first row is often deleted as this is the first one encountered in a table scan, but that is not guaranteed. Ref: DELETE - https://learn.microsoft.com/en-us/sql/t-sql/statements/delete-transact-sql?view=sql-server-ver16 |
Featured Script |
Convert Lat/Lon Decimal Degrees to Trigesimal Codes Todd M. Owens from SQLServerCentral Simplified latitude / longitude in 10 fixed bytes.
|
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 |
How to remove unallocated space after partitioning - Hello, I've recently done partitioning on a table (postcode column) and created new filegroups for each postcode. Now that it is no longer using the PRIMARY filegroup, the file size is still as it is. How do I reduce it or shrink it as it appears that there is a huge unallocated space? I attached […] |
SQL Server 2016 - Development and T-SQL |
Project for DTSx can't be opened in Visual Studio 2017 - Hello, I copied entire folder of the project/soultion for DSTx (SSIS) on another Windows 2019 server/SQL 2016. But the project is not working there. Unsupported This version of Visual Studio is unable to open the following projects. The project types may not be installed or this version of Visual Studio may not support them. For […] |
combine values as pivot - I have the following results after running a SQL. The first 2 columns are the result of the SQL. The 3rd column is what I try to achieve. So combining all values where name is the same in a new column. Is this possible using a pivot? or any other suggestion? Thanks |
Administration - SQL Server 2014 |
Mirroring transport endpoint error:8474 - I see several posts regarding this error. I feel I don’t need to stop and start the endpoint. We are using SQL 2014. I am seeing in the error log. An error occurred in a service broker/database mirroring transport connection endpoint,Error:8474, state:11. (Near endpoint role: Target, far endpoint address). The database mirroring is in healthy […] |
Development - SQL Server 2014 |
How Can I let Insert, update and delete sql statement work in a user-defined fun - I encode Insert and update statements in a user-defined funtion on some tables(not temp table and not table variable) in SQL Server, but when I use Execute command to create this function in SQL Server management studio, it shows Invalid use of a side-effecting operator 'UPDATE' within a function. Invalid use of a side-effecting operator […] |
SQL 2012 - General |
I need some urgent help! - I am working with SQL Server and needed some help with a query When you run this "SELECT 'YES' it would print Yes in column 1 Row 1, I want to print a dynamic list, so it doesn't look at a existing table. So if criteria 1 is met it would print YES/NO/Maybe and […] |
SQL Server 2019 - Administration |
SQL 2019 SQLBrower.exe - Hi, Has anyone encountered an issue like this before - I have a 3 node active, active passive cluster running a variety of SQL Editions, 2014 up to 2016. Recently I installed SQL 2019 (CU17) and the SQLBrowser service although running was not working. No firewall, no blocked port, no missing SQLBrowser.exe file, Service running […] |
Pitfalls of setting up MySQL as a linked server in SQLEXPRESS - I have a database in MySQL 5.7 that I need to link to a DB in SQLEXPRESS so that I can selectively migrate data. The MySQL server is 64-bit. Whenever I try to install 32-bit MySQL Connector/ODBC 8.0, and set the MYSQL up as a 32-bit System DSN on the machine with SQLExpress and SSMS […] |
SP_whoisactive duration vs Profiler Duration for SP_prepexec statements - Hi I have an application that executes statements using sp_prepexec and an sp_unprepare after each statement. In profiler a common statement will take 5 reads, no CPU and sub millisecond. When I capture the same statement in Sp_whoIsActive, it gives a duration of 4 seconds, and sometimes hundreds of thousand of reads. Does anyone know […] |
SQL Server 2019 - Development |
STAT command conindex equivalent - Hi, does any one whether there is an equivalent function on SQL to the STATA command conindex. We have a user processing 194 million rows of data via STATA using this command and it would be a whole lot easier if it was at he SQL level. Any help very welcome.. Thanks, Eamon |
SQL bug - Hello, I am trying to run a query but it does not like the date format in two of the strings. This query works on other colleagues laptops so I am wondering if it is a bug with the laptop. the problematic string is copied just below: [DatesInYear].date_1 >= '2021-11-01 00:00:00.000' AND [DatesInYear].date_1 <= '2021-11-30 […] |
Fact Table Agreggate with Sum - I need help populate de Fact Table in my DW. i need to sum the quantity and other columns (this is just a small part of the data source) which has to be grouped by Family,SubFamily and SubSubFamily. I generate a surragate key for the sales dimension but when i populate the fact table i […] |
Inserting Recurring Notes on Scheduled Dates - I am having a problem with a T-SQL stored procedure whose purpose is to insert recurring notes into the tblNotes table from the tblRecur table where the schedule specified in a record in tblRecur applies to a given date. Here’s my code: ALTER procedure [dbo].[uspAddRecurringNotesOnDate]( @OwnerID int, @Dt datetime ) AS -- Get table of […] |
how to get 3 days moving average in my sql - I have 2 tables: users, traffic. The first table consists of the users information (id, name, user_type) . The second table consists of the time of each visit to the website:(user_id, visited_on, time_spent). Trying to write a query to show the 3 day moving average of time spent on the website for users.user_type='user'. Also, avg_time_spent […] |
Integration Services |
Oracle Connector missing in VS 2019 - I need to convert our existing 2017 SSIS packages to 2019. Many of these connect to Oracle 19c dbs. In VS2017 we used the Attunity connector successfully. I currently have VS2017 and VS2019 installed on my development machine to allow me to work through the conversion. I have installed VS2019 with the required extensions and […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |