Laden...
|
|
|
|
|
|
Question of the Day |
Today's question (by Alessandro Mortola): | |
The "ORDER BY" clause behavior | |
Let’s consider the following script that can be executed without any error on both SQL Sever and PostgreSQL. We define the table t1 in which we insert three records: create table t1 (id int primary key, city varchar(50)); insert into t1 values (1, 'Rome'), (2, 'New York'), (3, NULL); If we execute the following query, how will the records be sorted in both environments? select city from t1 order by city; | |
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 Backup File Extension I run this command in SQL Server 2022. What is the extension of the backup file? BACKUP DATABASE HerdofTwo TO DISK = 'HerdOfTwo_20240501'Answer: there is no extension Explanation: The convention for SQL Server database backup files is to use .bak, and in very old versions (4.2) .dmp. However, this is convention. There is not requirement for this extension to be used, nor is one required. In this case, no extension is provided, so the file is created without any extension. This is not documented, but try it. You can create a backup without any extension. |
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 - Administration |
SQL server native CDC - Have anyone implemented CDC, and if so, what has been your experience with it? We are considering using this CDC data as the foundation for our ETL process, which will also support our Audit database. We have around 100 tables that we need to put in CDC and then use them in our ETL process. […] |
SQL Server 2016 - Development and T-SQL |
process records in loop - I'm only processing 50,000 records not everything from the Table where there are 250,00 records. What have I done wrong in code Thanks. DECLARE @BatchSize INT = 50000 DECLARE @IdControl INT = 1 DECLARE @Results INT DECLARE @SQLString NVARCHAR(MAX); DECLARE @ParmDefinition NVARCHAR(MAX); WHILE (@Results IS NULL OR @Results > 0) BEGIN print @IdControl print @BatchSize […] |
Fine-tune SQL for better performance - I have been asked to fine-tune the following SQL that was written by a former employee. The DBA says that using the select tables in inner join subquery is causing heavy resource usage as it selects all the rows from the tables. He wants to know whether I could use the fields at the beginning […] |
SQL Server 2019 - Administration |
client_app_name is empty in Extended Events output but present in sp_who2 - I'm tracing activity on one database and would like to include the client_app_name in the output. However, for *some* applications, this information is blank. However, if I run sp_who2 at the same time, I can see the ProgramName column is populated. Is there somewhere else that extended events stores this information or is it just […] |
Restore dbs - The below code works for backup files only from local drives. When replaced with a network path the code just runs through but does not restore any dbs. SET @backup_path='\\ABCD\E$\BackupsTest\' ; - Does not work. Where is it going wrong ? DECLARE @backup_path nvarchar(300); DECLARE @restore_path nvarchar(300); DECLARE @cmd nvarchar(1000); DECLARE @file_list TABLE (backup_file […] |
CDC Custom Alert - Hi All, I am writing an alert in a sql agent job, basically if my CDC latency is more than 30 minutes I should get alerted, I have tried various approaches but with not use, if any of your experts have implemented it already, can you please help me with the code. |
SQL Server 2019 - Development |
Sort comma delimited string in column - I have a column that contains comma separated values. I'm trying to figure out how to sort the comma separated values by a certain order. The sort order will be hard coded in the select statement since it does not exist in a table. I've tried using STRING_AGG WITHIN GROUP to sort the values but […] |
How to use a scalar function in INSERT stmt? - Hello all, I would like to create an INSERT statement and use a UDF as part of the VALUES() set. The UDF generates a unique product code based on the last inserted product code value. Now that I'm typing this out loud, I'm not so sure this would work for more than one record at […] |
SQL Azure - Administration |
Aligning Compatibility Version Strategy - I have joined a new project, where the business uses Azure SQL Hyperscale for production. I have noticed that some Prod environments have compatibility levels set to 150, but some - 140. Same applies to Dev / Test SQL 2022 environments. I have been given a task to come up with a strategy on how […] |
azure synapse analytics - Dears, Hope this message finds you well I did not see in this foruns anything related with synapse, hence, if you don't mind I will add my questions here. Maybe you can help me In my company (for which I was now contracted as IT architect) I can across something which seems unusual to me […] |
General |
SSIS Web Service task SSL errors - I've tried different credentials, target server versions, etc. hitting our Primavera WSDL. Works great in any browser. Via the Web Service SSIS task, I get an error when running the package: Target Server 2016: --1. Connection manager "HTTP Connection Manager 1": SSL certificate response obtained from the server was not valid. Cannot process the request. […] |
SQL Server 2022 - Administration |
Import and Export wizard stuck on Guest user - I'm getting a error when using the Import and Export wizard to copy tables between a remote database and a local database using the Microsoft OLE DB Provider for SQL Server as Data Source. The remote DB uses SQL Server authentication and the local DB uses Windows authentication. Regardless of which database is the Source […] |
Db growth rate - Sample data: jan 10gb feb 15gb mar 16gb april 14gb(truncate data) may 18gb june 22gb Is there are db growth rate formula which can be used to predict say next 3/6 months of db growth rate. Thanks |
SQL Server 2022 - Development |
How to compare data in customer table with other customers to find related cust - select Custno, Addr1, City, Res_Phone, Bus_Phone, Fax_Phone, Marine_Phone, Pager_Phone, Other_Phone, email1, email2 from customer c where Active='Y' -- About 1.5 Million Records Here in this sql server table, I have customers table, custno is unique id. we are trying to grouping customers and give one ID lets call it groupingID. INSERT INTO customer (Custno, Addr1, […] |
Row-level security in SQL server - In this scenario, I seek assistance in implementing row-level permissions for a table named 'user' with columns 'username' and 'role'. The objective is to establish a security model where access to individual rows is controlled based on the role assigned to each user. Specifically, the permissions should adhere to the following criteria: role='members' can only […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. [email protected] |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Laden...
Laden...