Questions tagged [sql-server-2005]
Use this tag for questions specific to the 2005 version of Microsoft's SQL Server.
sql-server-2005
18,355
questions
0
votes
0
answers
22
views
Locked out of SQL Server 2005 .... User number set to "1" in Enterprise manager? [migrated]
Whilst trying to restore a "master" backup file (on my Windows Server 2003 / SQL Server 2005) machine I've dropped a clanger and re set the number of users from "0" (unlimited) to &...
0
votes
2
answers
100
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;...
1
vote
1
answer
59
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 @...
0
votes
1
answer
42
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 ...
0
votes
0
answers
39
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 ...
0
votes
1
answer
85
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_
...
0
votes
0
answers
122
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. ...
-1
votes
1
answer
115
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 ...
0
votes
1
answer
80
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-...
1
vote
4
answers
94
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 ...
-1
votes
3
answers
130
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
...
0
votes
0
answers
109
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 ...
0
votes
1
answer
120
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 ...
1
vote
0
answers
77
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 ...
1
vote
3
answers
738
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, ...
0
votes
0
answers
889
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 ...
0
votes
1
answer
54
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, ...
0
votes
1
answer
374
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 ...
0
votes
1
answer
45
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
...
0
votes
1
answer
48
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
0
votes
0
answers
33
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 ...
0
votes
0
answers
62
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 = ...
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 ...
0
votes
1
answer
30
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 ...
-2
votes
1
answer
42
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 ...
1
vote
0
answers
147
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
...
-1
votes
2
answers
55
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 ...
0
votes
0
answers
25
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 ...
0
votes
1
answer
888
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(...
0
votes
1
answer
45
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, ...
0
votes
1
answer
302
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 ...
0
votes
0
answers
342
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 ...
-1
votes
2
answers
11k
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 ...
1
vote
1
answer
141
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 ...
0
votes
2
answers
188
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
...
1
vote
0
answers
143
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 ...
4
votes
1
answer
477
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 ...
0
votes
2
answers
137
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
...
-1
votes
1
answer
67
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,...
0
votes
1
answer
38
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 ...
1
vote
0
answers
76
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 ...
1
vote
1
answer
176
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.
// ...
0
votes
1
answer
354
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,
[...
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 ...
0
votes
0
answers
36
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 ...
0
votes
1
answer
261
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
...
0
votes
2
answers
77
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 ...
0
votes
1
answer
1k
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)
);...
0
votes
0
answers
672
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.
...
-1
votes
1
answer
82
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 ...