Category "sql-server"

Extract data from XML document using t-sql

I have been trying to extract data from the following xml doc using t-sql on sql server 2019. XML: <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9

How to connect database to data files in Azure Blob?

This resource states that a Azure SQL database may be attached to a database by using the following command: WITH IDENTITY='SHARED ACCESS SIGNATURE', SECRET =

Decoupling Win authentification, ODCB driver authentification and SQL authentification - ODCB auth error and DLookup error

I'm trying to connect a user to my company's postgreSQL Server to access a postgres database via MS Access 2019. Connection should be established via ODCB drive

Results in ascending order with cursor

I have the following My Guitar Shop exercise in my SQL II course and am stumped with the part about getting the results in ascending order through the cursor. A

Values in Hibernate

I want a row in hibernate that only takes ("yes","no"," "), how can I map it? Something like an ENUM type in SQL but mapped in Hibernate

Can you run or debug a SQL Server stored procedure without side effects? [closed]

I would like to be able to see the effects of running a Stored Procedure that someone else has written or other SQL code on a production datab

Multiple SQL Server statements do not work on same form

I am working on a C# project with a Microsoft SQL Server database. This is how I have connected the database: DataSet ds_display = new DataSet(); SqlDataAdapte

T-SQL Check if the database contains certain tables and columns MSSQL

My goal is to continue in the procedure only with the database selected if it contains a specific table and a specific column. So that I don't get an error mess

SQL Server: UPDATE based on whether a value is greater or lesser than another value, in a single query

I'm looking to update SQL Server in a single query based on a date, however the value updated depends on whether it is greater or lower than a provided value (i

Use variable in xml path in xml.modify

Edit: SQL Server 2016. I'm running several xml.modify statements that all use pretty much the same path. I originally put an example that didn't match my err

Given a string path, find the leaf node

I am using this table and data where all children of a parent node are uniquely named. CREATE TABLE [dbo].[Resources]( [Node] [hierarchyid] NOT NULL, [N

Liquibase Formatted SQL and SQL Server Stored Procedures

My team is trying to get Liquibase-formatted SQL to work with SQL Server Enterprise. We have no problem creating tables, but whenever we try to create a stored

Error validating formula for calculated column

I'm trying to make up a calculated column that evaluates an existing column with a CASE statement. The following code works fine: CASE WHEN Technician_Produc

count how many people who buy the same item at second time and how many people who did not buy the second item at second time (compare to firsttime)

Here is the question:count how many people who buy the same item at second time and how many people who did not buy the second item at second time (compare to b

SQL Server : unable to save decimal digits

I am facing a peculiar problem. I have a few tables in SQL Server where I have properly declared a few columns as decimal(18, 2). Unfortunately, whenever, I sav

Is there a way to return a Stored Procedure Return_Value to the python script executing it?

I am writing a python script that should update a log table and notify me of it. Part of this script is to execute a SQL Server stored procedure. I get an email

Return 0 if no row found in SQL Server using Pivot

Thanks everyone, and thank you @Aaron Bertrand, your answer solved my problem :) ! i am struggling to find a solution to my problem, here is my query in SQL Ser

Total up transactions

I am using SQL Server Management Studio v18. I have an original transaction that might get adjusted either by amount or by commission%. I want a query to total

SQL Server - Order by defined hierarchy

I have, for example, the following table: Client ID Function 1234 RE 1234 WE 1234 SP 1234 AG 6789 AG 6789 WE And I want to get only 1 client ID but that obeys

How to proxy MSSQL connections over TCP proxy with cached Kerberos credential?

I need to proxy MSSQL connections over a TCP proxy using cached kerberos credentials. The idea is to authenticate against the database with kerberos, cache the