Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Filter by
Sorted by
Tagged with
0 votes
1 answer
255 views

Update query failing for unknown reason

I have a procedure that pushes data from my local SQL Server 2005 database into a table in an Azure DB which is set up as a linked server. The basic data flow is create a #staging table, fill the #...
tkeen's user avatar
  • 372
0 votes
2 answers
149 views

Extract and process substring between varying numbers of delimiters in a variable length string

I have a table dates with a column SENTDATE where each row has a varying number of dates in it, separated by a semi colon (;). The dates are currently in the format YYYYMMDD - for example: 20240529;...
MeltedMetal's user avatar
1 vote
1 answer
93 views

How to dynamically set the value of a parameter in sp_executesql without modifying the calling software

I'm currently working with a stored procedure that executes an INSERT statement using EXEC sp_executesql. The procedure takes several parameters, including @TRANSACTIONNUM, @CUSTOMERNUM, @VALUE, and @...
zolei's user avatar
  • 25
0 votes
1 answer
76 views

How to pass symmetric key to query

I want to know how to pass symmetric key to SQL query as parameter. I'm usually hardcoding it within the query as follows: OPEN SYMMETRIC KEY SymKey DECRYPTION BY CERTIFICATE CertiFi; SELECT * FROM ...
Mark's user avatar
  • 91
0 votes
0 answers
53 views

Possible reasons for an SSIS conditional split into the same destination table?

I've been given the unenviable task documenting the catalogue ingest process of our data warehouse. All was going well until the end where I came across the use of a conditional split inside of an ...
DickMille's user avatar
0 votes
1 answer
98 views

Replace occurrences of characters in a string

Values in the column Name_Orig look something like this: **Ang-Stl-A36-6X4X.5**Angle,A36*,4X6X1/2**** I want First occurrence of ** to be replaced by Xx_ Second occurrence of ** to be replaced by a_ ...
ITBrute's user avatar
0 votes
0 answers
258 views

What does the value 30 indicate in the type column in the MSrepl_commands table?

Result Set of MSrepl_commands I want to infer that whether its a insert/update/delete command . We need to check at day end the amount of data replicated per article by the transactional replication. ...
BK Shailender's user avatar
-1 votes
1 answer
140 views

What is the fastest way to extract data from SQL Server 2005 using PowerShell 7?

This is not just a simple extraction. I have two tables. I take the values from one table and then use one column from this table to find a corresponding value in another table and then extract all ...
Brute's user avatar
  • 43
0 votes
1 answer
97 views

Auto applied migrations using EF Core 7.0.14

When I make a new migration (Add-Migration Example) , and then I try to get all the migrations (Get-Migration) I find that the "applied" field is "True" without even using (Update-...
elshater hassan's user avatar
1 vote
4 answers
117 views

Need a SQL Query for Getting matched and not matched Records

My table structures are shown here: Table1 Col1 10 20 20 20 30 30 40 Table2 Col1 10 20 30 40 My expected result is this: Col1 Col2 10 Matched 20 Matched 20 Not Matched 20 Not Matched 30 Matched 30 Not ...
Kannan's user avatar
  • 11
-1 votes
3 answers
326 views

SQL Server query returns multiple line results instead of returning 1 line

Using SQL Server, I have multiple tables: Assignments aID, acID, clientID, userID, pos, dateOn AssignmentCarriers acID, clientID, cName, isAssignment Users userID, fName Clients ...
Damien's user avatar
  • 4,339
0 votes
0 answers
148 views

Write error with spark.write against SQL Server table (via JDBC Connection)

We are trying to save a DataFrame in SQL Server (V2005) using the following method: df_cards.write.jdbc(url=conn_str, table=tablename, mode='append', properties=properties) However, we encountered ...
Moisés's user avatar
  • 105
0 votes
1 answer
156 views

Extract data using multiple conditions for the column value?

From a certain column I need the following type of data: Value is 6 characters long and is numerical “L” is any letter followed by 5 numerical characters, for example L12345 the L needs to be turned ...
Brute's user avatar
  • 43
1 vote
0 answers
108 views

MS SQL SERVER 2005 temp db log file size is increasing

Sometimes, when there is no load on the server, the size of the MS SQL database tempdb log file (templog.ldf) starts increasing. As a result, the available space on the C drive decreases. To resolve ...
madhukumar's user avatar
1 vote
3 answers
1k views

How to get the sum of a column for the current month?

I have a column Amount which I want to get its sum by month within each year. I have tried the following query and it works well for year but month is summing up incorrectly. For instance in this May, ...
User_K47's user avatar
0 votes
0 answers
2k views

Cannot connect to server - An existing connection was forcibly closed by the remote host

I have updated my PC to Windows 11 Pro ver 22H2, Os build 22621.1 After this update, I cannot connect to SQL Server 2005 from SSMS v.18.4 Client OS: Windows 11 Pro ver 22H2, Os build 22621.1 Client ...
Rauf's user avatar
  • 12.9k
0 votes
1 answer
73 views

MS SQL Sort Alphanumeric values (1, 2, 3, 5, 6, 7, 9, 10, 4a, 8a, 4b, 8b) [duplicate]

In SQL database (2005/2008), I have a field named Ordernumber having the following values: 1, 2, 3, 5, 6, 7, 9, 10, 4a, 8a, 4b, 8b I want a way to sort them to be 1, 2, 3, 4a, 4b, 5, 6, 7, 8a, 8b, 9, ...
Fadl Assaad's user avatar
0 votes
1 answer
545 views

Is there a way to Manually unlock the Opentext Exstream Design Database?

I have encountered an error after attempting DB Maintenance from within Design Manager, and cannot figure out how to get the DB unlocked. Essentially, ran the DB check for errors utility, and during ...
cartomeo's user avatar
0 votes
1 answer
47 views

how to put a count or sum to all duplicates and make every unique data has a row

I have this table called Table1 with fields subkey, category and frequency. I want to populate the frequency by counting per category. Subkey Category Frequency AA apple BB apple CC banana BB grapes ...
Joe's user avatar
  • 1
0 votes
1 answer
69 views

SQL Server 2000 database after restore to 2005 is empty

I have very old backup file (.bak) of SQL Server 2000. After restoring it to SQL Server 2005, the database looks empty (please see screenshot). What is the probable cause? screenshot
borozu's user avatar
  • 9
0 votes
0 answers
39 views

How to configure the session to stop executing all following commands on first error?

Suppose I have a script: alter table .... go insert into ... go alter table ... go delete from .. go How do I configure this session at the beginning of this script, so that if any of the four ...
user avatar
0 votes
0 answers
65 views

Can't connect firebase functions with google cloud sql

I'm hosting a sql instance on google cloud sql. Firebase functions worked with this instance flawlessly. Now it stopped working out of nowhere and I can't seem to get any error. Code: const mssql = ...
Abdelrahman's user avatar
0 votes
0 answers
26 views

What is wrong with my SQL RESTORE statement?

I am trying to recover a database for a customer who has been depending on MS Dynamics for a long time. His Server 2003 data drive failed irrevocably, but he had a recent backup of the his Server ...
Kevin Drew's user avatar
0 votes
1 answer
41 views

I want order details also like order columns

select o.*,x.cust_name from( select cust_name from customer c where salesman_id IN( select salesman_id from Orders o where ord_date ='2012-08-17'))x I only got customer names but i need order ...
RamaKrishna's user avatar
-2 votes
1 answer
55 views

By using single CTE with multiple statements in it. can I perform mathematical operations on CTE output to get final output?

Below is my CTE Example It's just a example my actual query is different ;with CTE as ( select 1+1 as A,2+2 as B,3+3 as C ) select (A+B)-C as Final_Count from CTE here in above example A,B & C ...
Atul Kadam's user avatar
1 vote
0 answers
184 views

Best way to create an SQL Server DB in AWS using Terraform?

To Devs, I am trying using the following: enabled_cloudwatch_logs_exports = var.enabled_cloudwatch_logs_exports create_cloudwatch_log_group = var.create_cloudwatch_log_group ...
user1154422's user avatar
-1 votes
2 answers
59 views

Need to rank the data in SQL Server

From the input data, I need to rank the id. The data is order by time ascending. Example: id number 421492036 has two record with code '05' and is ordered by time ascending. The ID 421492036 has same ...
Simma's user avatar
  • 23
0 votes
0 answers
28 views

Create an Identity column [duplicate]

I am trying to create a column with incrementing numbers inside a group as per Table below. RecordID OrderID IncrementInGroup a 1 1 b 2 1 c 3 1 a 4 2 a 5 3 a 6 4 a 7 5 b 8 2 c 9 2 I am having dozens ...
Likvor's user avatar
  • 1
0 votes
1 answer
1k views

How to resolve "...Error occurred during the execution of xp_cmdshell"?

The engineers uses this Access based app that takes data from SQL Server 2005. The users download a file containing details of parts etc make amendments and upload it again. When the file is upload(...
Brute's user avatar
  • 43
0 votes
1 answer
55 views

How to limit the results of a query and group them together,

I have the two tables pictured from a "city jail' DB, one is the sentences given to criminals and the other criminal information. I am trying to write a query the lists only the criminal_id, ...
dheeke's user avatar
  • 37
0 votes
1 answer
336 views

SQL output error when try to find duplicate value in a table

select count([Item Nbr]) as [Item Nbr], count([Item Flags]) as [Item Flags], count(UPC) as UPC, count([Store Nbr]) as [Store Nbr] , count (RetrievalWeek) as RetrievalWeek, * from ...
pika's user avatar
  • 1
0 votes
0 answers
373 views

Linked servers, results query xp_cmdshell to table migration SQL Server 2005 to SQL Server 2019

I'm migrating procedures from Microsoft SQL Server 2005 to Microsoft SQL Server 2019 and I got stuck while trying insert query result xp_cmdshell in linked servers to table I'm out of ideas Old ...
wielebny's user avatar
-1 votes
2 answers
17k views

Subtract hours from current date time and compare to column value whose data type is datetime

I want all the MAFN column values that were added to the table in the last hour(:mm). The column ReturnDt stores the time it was added in DateTime format ex.'2005-01-11 08:50:24.767' I can get the ...
Brute 's user avatar
  • 141
1 vote
1 answer
154 views

Get the history values based on Revision Id

I have a two table table, first table storing all the latest data and second table to capture the changed data. For example if an user change value the FIRST table will update the data and SECOND ...
David Lee's user avatar
0 votes
2 answers
245 views

How to retrieve data from SQL Server 2005 on Windows Server 2008 R2 on static IP, in a secured manner to Power BI? [closed]

Situation My company software is running on SQL Server 2005 on Windows Server 2008 R2 with a static IP. Requirement I wanted to access data for reporting into Power BI. What I have tried so far ...
amitdigga's user avatar
  • 7,316
1 vote
0 answers
159 views

Prevent rspec from running migrations

I have a rails app with a sql server database. I manually create an empty database for rspec to test on with all the necessary tables before running the specs. Currently when running the specs the ...
marrnj2's user avatar
  • 11
4 votes
1 answer
718 views

Multi step table value function faster than inline table value function

I know, I know. It's not supposed to be this way. Big picture, I'm working with map data and trying to determine which street a bus stop is closest to. A street is made up of a series of points. Some ...
George Mastros's user avatar
0 votes
2 answers
152 views

Calculate Running Total Summary based on Different column

I need output like below StockQty = 10 Balance Qty [Allocate Stock Qty] Shortage [Stock] Running Stock 5.000 5.000 0.000 5.000 10.000 5.000 5.000 0.000 5.000 0.000 5.000 0.000 10.000 0.000 10.000 0....
Zoyeb Shaikh's user avatar
-1 votes
1 answer
69 views

Find Running Total In sql - if 1st column has no value then calculate from 2nd column

declare @tbl as table ( ItemId int, SOQty int, DIQty int , IssueQty int, BalanceQty int, CreateDate datetime, StockQty int, WIPQty int ) insert into @tbl values (1,10,...
Zoyeb Shaikh's user avatar
0 votes
1 answer
39 views

combining Rows in SQL which are in the same column

I am trying to combine two columns into two rows. I am unbale to work it out with the PIVOT table. My table looks like this name | status | timestamp 212 50 t1 213 50 t2 212 ...
Engineers Kitchen's user avatar
1 vote
0 answers
84 views

Not able to fetch User who is having Permission as part of CERTIFICATE as Securable in SQL Server

Purpose of the query is to fetch all permissions for Particular user with all the details. Please find my query below : SELECT 'permUser1@master' AS dbUserName, dp.NAME ...
Suraj Kudale's user avatar
1 vote
1 answer
213 views

Select Min() and other columns and GroupBy by two columns in EF 6

Using the example below, (from the answer in this link here) how can I select/group with an extra column ? I have searched this site and others and tried some examples but couldn't get it to work. // ...
Ben Junior's user avatar
  • 2,591
0 votes
1 answer
455 views

Flask SQL Alchemy try perform SET operation, when it is not needed

I am facing a very strange issue using SQL Alchemy. I have a table in SQL server, to store Sales, with this format : CREATE TABLE Resale ( [address] VARCHAR(100) NOT NULL, [id] BIGINT NOT NULL, [...
kilag's user avatar
  • 576
1 vote
3 answers
1k views

SQL Query to determine number of tables

I have this table and I'm trying to determine how many Tables (in a restaurant) are awaiting food. The table( in the database) has the following columns: TableNumber, ObjectType, ObjectDescription and ...
OldJan's user avatar
  • 13
0 votes
0 answers
40 views

Remove Duplicate Rows in SQL 2005 with primary key identity seed and Date Time Stamps

Columns: ID (int) , Part (varchar), DF0 (varchar), DF1(varchar), DF2(varchar), DF3(varchar), DTI(DateTime) All the samples I seem to find can get me the count or the data minus the ID and DTI. I need ...
BillyDvd's user avatar
  • 176
0 votes
1 answer
329 views

SQL: Running total with group by

I have a dataset that has two date columns for each transaction. An invoice date and a charge date. I am trying to do a cumulative or running total of the table in sql. Data table looks like this ...
Rishtin's user avatar
0 votes
2 answers
80 views

SQL adding row if it does not already exist

Say i have this table Product Version Value 1 1 1000 2 1 2000 3_a 1 2500 3 1 3000 2_a 1 1200 What i want to do is: For each row where product does not end with '_a': check if there is any row with ...
StarStreeto's user avatar
0 votes
1 answer
2k views

LEFT JOIN returns duplicate SUM values

I have the following tables: create table Invoices ( InvoiceID int, InvoiceNumber int, InvoiceDate date, SupplierName varchar(250), SupplierCode varchar(20), InvoiceValue decimal(18,2) );...
milo2011's user avatar
  • 339
0 votes
0 answers
848 views

IN condition with parameters using sqlalchemy

I'm need some help for making a query with SQLalchemy and SQL server using a simple web form. Form fields are datefrom, dateto, and name so any user can filter the query base on their preferences. ...
DSgUY's user avatar
  • 101
-1 votes
1 answer
98 views

How do I get record with Max(date) and then compare values to get result

I am trying to get record with Max(StartDate) for each MeterNumber and then try to get records where startdate, enddate & RateCode is different for specific AccountNumber. Sample data script as ...
tt0206's user avatar
  • 847

1
2 3 4 5
367