Questions tagged [sql-server-2005]
Use this tag for questions specific to the 2005 version of Microsoft's SQL Server.
18,388
questions
-1
votes
3
answers
68
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
61
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
0
answers
56
views
How do I check if these warnings while using SQL Server Import and Export WIzard will cause me any issues?
I was importing data from one SQL Server to another and I got a few of these errors.
Setting Source Connection (Warning) Messages
Warning 0x8020400d: Source 3 - blank [370]: The Source 3 - blank....
0
votes
1
answer
47
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
40
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
269
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
312
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
41
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
146
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
42
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
40
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
25
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
54
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
24
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
0
answers
29
views
the connection was reset but the script is running
I have a problem when the process from PHP to SQL server to run the trigger appears like this. Even if viewed from within the database the query is running. Can anyone help me find the answer?
I hope ...
0
votes
1
answer
27
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
35
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
101
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
1
answer
43
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
449
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
26
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
229
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
291
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
5k
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
112
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
143
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
115
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
341
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
125
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
63
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
37
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
66
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
95
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
240
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
853
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
29
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
144
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
76
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
927
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
491
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
68
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 ...
0
votes
2
answers
869
views
How do I compare values from same column and different row but same table?
I am trying to get records where startdate is different for specific account Name. I have below sample data.
Sample data script as below
create table Meter (AccountNumer varchar(50), MeterNumber ...
0
votes
0
answers
39
views
Stored procedure starting with #
I was running a trace on an application today and saw this for the first time ever, in the text data of the trace:
exec #spDMF1F848FB98D743F69BA4AF02A7C05927
Can't seem to find anything online ...
0
votes
2
answers
90
views
How do I prevent duplicates from a SQL join?
I have the following tables:
customer:
id
customer_number
company
firstname
lastname
account_manager_email
email
comments
terms
tax_id_number
lead_source
default_catalog
credit_limit
99453
C00123456
...
0
votes
3
answers
2k
views
Convert seconds to HH:MM:SS with hours more than 24
I want to convert 97200 seconds to HH:MM:SS format. I have used the below SQL Server syntax but it works as long as hours are less than 24 hours
select convert(varchar,dateadd(s,round(convert(double ...
0
votes
1
answer
65
views
Entity Framework Remote SQL Server
I have 2 machines, one that have an SQL Server with all the data in it, and another one that has the client dashboard.
Both machines are not physically in the same location, so the Entity Framework ...
1
vote
2
answers
2k
views
Modify SQL_Variant Column to VARCHAR
I have a table where one of the columns has a sql_variant datatype. I'm trying to modify the column to VarChar(800) but I'm getting an error:
Implicit conversion from data type sql_variant to varchar ...
0
votes
0
answers
475
views
Connecting to MS SQL Server 2005 using PHP 8.0 or PHP 7.4
I am rebuilding a service that is using MSSQL Server 2005 along with PHP 4.3.11. There is a maintenance issue that I will need to address, and I would prefer to not write obsolete code now only to ...
1
vote
1
answer
2k
views
When is DbContext.Entry(enttity).State = EntityState.Modified; required?
I want to clarify when I need to set the EntityState with Entity Framework Core.
Context: code-first C# Blazor Server App, SQL Server database.
Consider:
public async Task UpdateHelper(Helper ...