Skip to main content

Questions tagged [sql-server-2005]

Use this tag for questions specific to the 2005 version of Microsoft's SQL Server.

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 ...
Rishtin's user avatar
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 ...
StarStreeto's user avatar
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) );...
milo2011's user avatar
  • 339
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. ...
DSgUY's user avatar
  • 101
-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 ...
tt0206's user avatar
  • 827
0 votes
2 answers
1k 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 ...
tt0206's user avatar
  • 827
0 votes
0 answers
71 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 ...
Code4Cash's user avatar
0 votes
2 answers
93 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 ...
Darrell Brogdon's user avatar
0 votes
3 answers
3k 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 ...
DataMan's user avatar
  • 169
0 votes
1 answer
66 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 ...
Ibrahim D.'s user avatar
1 vote
2 answers
4k 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 ...
stargazer77's user avatar
0 votes
0 answers
507 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 ...
JohnTheDev's user avatar
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 ...
David Jones's user avatar
0 votes
2 answers
72 views

How to get the same result from aggregation

Like: name metric A 1 a 1 SELECT SUM(metric), name FROM table_name GROUP BY name Is there a way that I can get the same name every time I run this? How does SQL Server choose a or A to present?
HappyFreddie's user avatar
-1 votes
1 answer
235 views

Script to change the SQL Default database location in windows

Can someone help me with any script like windows script, BAT script or SQLcmd script for changing the default database location of SQL. I am using Windows
Manasa gowda's user avatar

15 30 50 per page