|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
Comparing Images | |
I am building an ETL process between these tables in SQL Server 2022 set to 160 compatibility level:
CREATE TABLE Image_Staging ( imageid INT NOT NULL CONSTRAINT Image_StagingPK PRIMARY KEY , imagestatus TINYINT , imagebinary IMAGE); GO CREATE TABLE Images ( imageid INT NOT NULL CONSTRAINT ImagesPK PRIMARY KEY , imagestatus TINYINT , imagemodified DATETIME , imagebinary IMAGE); GOI want to run this query to check if the images already loaded exist. This will help me decide if I need to insert or update an image. What happens with this query? SELECT i.imageid FROM dbo.Image_Staging AS ist INNER JOIN dbo.Images AS i ON ist.imagebinary = i.imagebinary; | |
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 the Database Encryption Key In my SQL Server 2022 database, I run this: USE Sales; GO CREATE DATABASE ENCRYPTION KEY WITH ALGORITHM = AES_256 ENCRYPTION BY SERVER CERTIFICATE MyServerCert; GO This works, but I want to prepare for the future and potential issues. How do I back up my DEK? Answer: This key cannot be backed up. Just backup the database Explanation: The DEK cannot be exported or backed up. Just backup the database. Ref: CREATE DATABASE ENRYPTION KEY - https://learn.microsoft.com/en-us/sql/t-sql/statements/create-database-encryption-key-transact-sql?view=sql-server-ver16 |
Featured Script |
Concatenating Multiple Row Values into a Single Comma-Separated List Sukhdevsinh Dhummad from SQLServerCentral In scenarios where you need to consolidate multiple rows into a single, comma-separated value, you can achieve this using FOR XML PATH. This script demonstrates how to retrieve volunteer data and display the days they have selected for participation.
|
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 |
Data cleansing/conversion tool HPE - Hello. I am looking for a tool Data cleansing/conversion, was recommended HPE any recommendation about this tool or any others ? Thank you |
SQL Server 2016 - Development and T-SQL |
strange selection for update - Hi, yesterday I had to update several rows of a table. The rows for update where selected by a select-statement for testing the results; the selection for the update-statement selected this sub-selection but I missed that I renamed the primary key within the selection; normaly I would think that SQL should raise an error (because […] |
Review what columns are used - I have a couple of databases One would be regarded as the source and another as the destination The destination is kind of a subset of source having gone through an ETL process Although the E part is scripted access as both databases reside on the same server So, there are a number […] |
Merge rows in SQL - I have a table like below ID Ident source val opendate closedate IsActive -------------------------------------------------------- 101 euid01 File01 x010 01-01-2023 01-01-2999 1 101 euid02 File01 x111 01-01-2023 01-01-2999 1 101 euid02 File01 x222 01-01-2023 01-10-2024 0 102 euid01 File11 x010 01-01-2023 01-01-2999 1 102 euid02 File12 x333 01-01-2023 01-01-2999 1 102 euid02 File10 x444 01-01-2023 01-10-2024 […] |
Development - SQL Server 2014 |
How can I tell if an UPDATE command updated any rows? - I am calling an Update routine from C# and need to determine if the Update routine found a matching row to update. If it does not, I call the Insert Routine. I was hoping that if no row was updated, I would get an error which would tell me that I need to do the […] |
SQL 2012 - General |
How to determine if a DB is currently being used - Hi - I'm looking for advice regarding the best & quickest way to establish whether or not a SQL2012 DB is being used. Many thanks Dax |
SQL Server 2019 - Administration |
Query is timing out - I have a view on ServerA that fetches some data from ServerB and ServerC. The linked servers are configured properly. The query itself runs fine on ServerB and ServerC. But when I run it from ServerA, I get 'Query timeout error', yet some days, it runs fine. Some days it executes in a minute but […] |
SQL Server 2019 - Development |
How to pass a variable in look up transformation in SSIS ? With Oracle database - We have a need to pass a variable in the look up query against Oracle database using SSIS, is there a way to pass a Sql query output (variable) in SSIS ? |
problem with PIVOT Table - Thanks in Advance! I'm having trouble grouping all counts and sums on one line for each county which should not look like (Code attached) Note one county is repeated and most are like that: County MH SA DD Cost Camden 0 0 1 152.88 Pitt […] |
Reporting Services |
Report server errors - http://servername/reports/browse/ could not load folder contents http://servername/reportserver The server principal "NT SERVICE\SQLServerReportingServices" is not able to access the database "ReportServerTempDB" under the current security context. How do I fix this ? Does this have anything to do with SPNs ?https://learn.microsoft.com/en-us/sql/reporting-services/report-server/register-a-service-principal-name-spn-for-a-report-server?view=sql-server-2017 |
Integration Services |
Visual Studio 22 / SSIS Project / (Project) Connection problem - Hello, First of all, I find it odd/annoying that I can't exclude a Project level connect from a package Connection Managers... at least I can not do it. Why should they show / fill the space in packages with nothing to do with those connections. But even more annoying is that when you have a […] |
SQL Server 2022 - Administration |
System views in a contained availability group - I have a query that runs in a job to check on orphaned users. On a server with a contained availability group it gives false positives. I pinned it down to the following different result of the same query. When I am in SSMS and connected to one of the servers in the AG. I […] |
SSISDB Folder creation Error - We recently installed SSIS on SQL Server 2022 machine. Trying to create a folder under SSISDB integration Services catalog is giving this below error. Operation 'Create' on object 'CatalogFolder[@Name='Testing1']' failed during execution. (Microsoft.SqlServer.Management.Sdk.Sfc) Cannot find either column "internal" or the user-defined function or aggregate "internal.is_valid_name", or the name is ambiguous. Cannot find the folder 'Testing1' […] |
Blocking Connection to Server - Good Afternoon, We recently procured a service management software for our company, which uses SQL server 2019( 15.0.2125.1) as backend. The client application uses sql usernames to login into the application . I find this as a security issue, as any internal user can directly connect to the server either through ODBC or through SSMS […] |
SQL Server 2022 - Development |
Update Function - Hello everyone, I need your help. I have a “datetime” column (data type is Varchar(64) )with the following content: Sun Sep 29 2024 09:28:55 GMT+0000 (Coordinated Universal Time) I would like to update the column so that I only get the time in the format HH:MM:SS. I have tried many solutions, but none of them […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |