|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
The Tightly Linked View | |
I try to run this code on SQL Server 2022. All the objects exist in the database.
CREATE OR ALTER VIEW OrderShipping AS SELECT cl.CityNameID, cl.CityName, o.OrderID, o.Customer, o.OrderDate, o.CustomerID, o.cityId FROM dbo.CityList AS cl INNER JOIN dbo.[Order] AS o ON o.cityId = cl.CityNameID GO CREATE OR ALTER FUNCTION GetShipCityForOrder ( @OrderID INT ) RETURNS VARCHAR(50) WITH SCHEMABINDING AS BEGIN DECLARE @city VARCHAR(50); SELECT @city = os.CityName FROM dbo.OrderShipping AS os WHERE os.OrderID = @OrderID; RETURN @city; END; goWhat is the result? | |
Think you know the answer? Click here, and find out if you are right. |
Yesterday's Question of the Day (by dbakevlar) |
SQL Server, Heaps and Fragmentation A table without a clustered index (heap) will NOT suffer from fragmentation during frequent updates or deletes. True or False? Answer: False Explanation: The answer is FALSE. In SQL Server, heaps (non-clustered indexes) can become heavily fragmented with frequent updates/deletes, especially when forwarding pointers are introduced. With modern storage technology advances, this is often remediated, but it's important when performance impacts are reported to identify if full scans of tables are occurring, identify the type of workload, (OLTP especially) and if a missing clustered index might not be needed. Ref:
|
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 |
Work out closing balance using opening balance of prior month - Hello, I think I need a recursive cte query but unsure of the logic. I have data for 3 Divisions for 12 months. For Jan, Closing (H) value is the sum of Open + Created + Won + Lost For all other months, it then also needs to include prior months closing, so the formula […] |
SQL Server 2019 - Administration |
how to optimise whole database full of table and sp in one go using githubcopilo - i have subscription of github copilot which i can access in vs 2022 comunity edition. i have been optimising my tsql in vs 2022 using githubcopilot. now i need to optimise my whole database which has many tables and sps. |
SQL Server 2019 - Development |
Is there a way to have dynamic table headers? - Hi everyone I have a SP which compares two tables and outputs mismatching entries: SELECT T1.QUOTE_DATE AS REPORT_UNIT_DATE FROM #UNIT AS T1 SELECT MAX(TRADE_DATE) AS REPORT_DIVISION_DATE FROM DBO.DIVISION SELECT T1.UNIT_SYMBOL AS UNIT_TABLE, T2.DIVISION_SYMBOL AS DIVISION_TABLE FROM #UNIT AS T1 FULL JOIN #DIVISION AS T2 ON T1.UNIT_SYMBOL = T2.DIVISION_SYMBOL WHERE T2.DIVISION_SYMBOL IS NULL OR T1.UNIT_SYMBOL IS […] |
is there a way to "detect" schema like changes on a server? - Hi, we have a few people who like to experiment on our prod sql server with new tables, schema changes, dependency chain breaks, maybe ssis, even ssrs etc etc without telling anyone till its too late. They hold high ranking positions so forget your first thought. I often end up with technical debt or sheer […] |
SQL Azure - Administration |
Azure elastic query credential question - I am trying to check out elastic query between two test instances we have in GCCH Azure. On the Microsoft learn page, it says that the first step is to create a master key and scoped credential as follows: CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'somegoodpassword'; CREATE DATABASE SCOPED CREDENTIAL [elastic_to_dev] WITH IDENTITY = […] |
Editorials |
The Security of Old Tech - Comments posted to this topic are about the item The Security of Old Tech |
Password Guidance - Comments posted to this topic are about the item Password Guidance |
Requiring Technical Debt Payments - Comments posted to this topic are about the item Requiring Technical Debt Payments |
Learning a New Language - Comments posted to this topic are about the item Learning a New Language |
Guidelines and Requirements - Comments posted to this topic are about the item Guidelines and Requirements |
Article Discussions by Author |
Revisiting SQL Server Window Functions- A Practical Walkthrough - Comments posted to this topic are about the item Revisiting SQL Server Window Functions- A Practical Walkthrough |
Tables with a SPARSE Column and Consumption - Comments posted to this topic are about the item Tables with a SPARSE Column and Consumption |
Using table variables in T-SQL - Comments posted to this topic are about the item Using table variables in T-SQL |
Using the FP-Growth Algorithm to Mine Useful Patterns in Data - Comments posted to this topic are about the item Using the FP-Growth Algorithm to Mine Useful Patterns in Data |
SQL Server 2022 - Administration |
SQL Server 2025 Jobs - Hello SQL Server 2022 16.0.4212.1 running on a Windows Server 2025 Std,V 24H2, SO OS build 26100.6584. SQL Agent service account: NT Service\SQLSERVERAGENT I have a series of jobs whose steps call SP of the same database. One of them scheduled to run at a specific time fails: "Job failed. The job was invoked by […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |